开发者

How do you do alias in Select method (LINQ)

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜