I have a list of this class:
public class Data
{
public string name {get; set;}
public int width {get; set;}
}
And I want to make a method that return a list of only the name property. Like this:
public List<string> GetAllNames()
{ return MyDataList<name>.ToList(); }
So, if I have this list:
name= Jon –width= 10name= Jack –width= 25
I want the following list:
name= Jonname= Jack
Is it possible?
Use LINQ: