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 });
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论