JosephEricDavis
asked on
C# - manipulate list of objects
I have a list object
List<TramsResourceCatalog> tramsList
One of the data members of TramsResourceCatalog is string PrimaryIdentifier
What is the easiest way of transforming my List<TramsResourceCatalog> into only being a list of the one property PrimaryIdentify, ie a List<string> of PrimaryIdentify.
What I'm currently doing is...
List<TramsResourceCatalog> tramsList = ScheduleService.GetTramsRe sourceCata logList();
List<string> test = (from tramsNSNlist in tramsList select tramsNSNlist.Base4DPrimary Identifier ).ToList() ;
But I think there must be an easier more simplistic way to do this that I'm just not familiar with.
Thanks
List<TramsResourceCatalog>
One of the data members of TramsResourceCatalog is string PrimaryIdentifier
What is the easiest way of transforming my List<TramsResourceCatalog>
What I'm currently doing is...
List<TramsResourceCatalog>
List<string> test = (from tramsNSNlist in tramsList select tramsNSNlist.Base4DPrimary
But I think there must be an easier more simplistic way to do this that I'm just not familiar with.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This is actually exactly what I was looking for. Thanks.
cool, not a problem. thanks for the grade.
List<string> test tramsList.Select(tramsNSNL