In C#, if I have a parameter for a function where the parameter type is of an interface, how do a pass in an object that implements the interface.
Here is an example
In additional to List.Cast, C#'s generics provide a good support for Covariance and contravariance. This example causes it to work in the way I think you originally intended.
public class Program
{
public static void Main()
{
Foo(new List());
}
public static void Foo(List bar) where T : IFim
{
throw new NotImplementedException();
}
public class IFim{}
public class Fim : IFim{}
}