Reputation: 3056
I am trying to take properties from a list of types and put them in another list. I am not exactly sure how you iterate through the list of objects to gain access to the properties.
For example:
List<images> myImages = new List<images>();
List<string> typeOfImage = new List<string>();
typeOfImage.Add(myImages.type);
Can someone help me in this?
Upvotes: 0
Views: 74
Reputation: 1455
if (myImages.Count < 0)
typeOfImage.Add(myImage[0].GetType().ToString());
Upvotes: 0
Reputation: 5103
Try this:
typeOfImage = myImages.Select(image => image.AnyPropertyYouNeed).ToList();
Upvotes: 4