In C#, I have a class A that I cannot modify. From this class I’ve created class B (i.e. inherited from A) which adds some properties. I also have a static function that returns List<A> when GetListOfA() is called.
How can I cast the return from GetListOfA() to List<B>?
e.g. List<B> bList = foo.GetListOfA() as List<B>
If you’re using C# 3.0 (Visual Studio 2008), you can: