Hi there,
I got a class X and a class Y, the latter which derives from X :
class x {}
class y : x {}
Then somewhere I am using a list of X :
List<X> lstX;
...
Then I'd like to use a new list of Y, from the data in my other list...something along those lines :
List<Y> lstY = lstX;
I would believe that the items in the list of X would get converted automatically into Y, but thats not the case.
Also, how could I initialize a new instance of Y, from a certain X? I would like to do :
var newX = new X();
var newY = new Y(X);
but it does not seem to work like that.
Thanks for your help! and sorry for formatting, trying my best