开发者

How do you do alias in Select method (LINQ)

开发者 https://www.devze.com 2023-03-14 10:43 出处:网络
I\'m trying to alias the string list with a named c开发者_开发知识库olumn: var providers = EMRRepository.GetProviders().Select(x => x as name);

I'm trying to alias the string list with a named c开发者_开发知识库olumn:

var providers = EMRRepository.GetProviders().Select(x => x as name);

where 'GetProviders()' returns a List<string>


It's called a "Projection", just select a new anonymous type.

var projection = data.Select( x => new { FieldName = x.Property } );


You are looking to select into a new anonymous type.

var providers = EMRRepository.GetProviders().Select(x => new { Name = x });
0

精彩评论

暂无评论...
验证码 换一张
取 消