You don't need reflection for this. LINQ, on the other hand, can help here: List myListOfJazzDancers = ...; List myListOfDancers = myListOfJazzDancers.Cast().ToList().
Thank you, it works. Then I realized that I can't really cast list of JazzDancers into list of Dancers and still have them be as JazzDancers, when it's possible to do that via using list . Add method and adding in actual instances of JazzDancers there.
– andryuha Nov 18 '10 at 3:12 @andryuha: Well, you can cast them to JazzDancers after retrieving them, if you are sure that the list only contains JazzDancers. On the other hand, if you are sure that it only contains JazzDancers, you might as well use a List in the first place... – Heinzi Nov 18 '10 at 15:02.
You can do it with a Linq query: dancers = jazzDancers.Cast(); If you need to do some kind of check on each jazzDancer, you just add a Where such as: dancers = jazzDancers. Where(jd => jd. SomeFiels == Something).Cast().
Example of what I'm trying to do is, I want to "resolve" a list of JazzDancer into a list of Dancer (which all dancer types inherit from). Want to make sure that if DanceStyle here is Jazz, only JazzDancer type will be in the list of dancers. Hope this make sense.
Problem is that it seems that you can't cast List to List. Is that even possible?
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.