Reputation: 4037
I'm trying to alias the string list with a named column:
var providers = EMRRepository.GetProviders().Select(x => x as name);
where 'GetProviders()
' returns a List<string>
Upvotes: 11
Views: 24067
Reputation: 126892
You are looking to select into a new anonymous type.
var providers = EMRRepository.GetProviders().Select(x => new { Name = x });
Upvotes: 2
Reputation: 7631
It's called a "Projection", just select a new anonymous type.
var projection = data.Select( x => new { FieldName = x.Property } );
Upvotes: 28