C# C从匿名类型中选择字符串列表
我有以下LINQ,我需要将结果作为列表返回,但我收到错误: 无法将类型System.Collections.Generic.IEnumerable隐式转换为System.Collections.Generic.List。存在显式转换。是否缺少强制转换 如何返回字符串列表C# C从匿名类型中选择字符串列表,c#,linq,generics,C#,Linq,Generics,我有以下LINQ,我需要将结果作为列表返回,但我收到错误: 无法将类型System.Collections.Generic.IEnumerable隐式转换为System.Collections.Generic.List。存在显式转换。是否缺少强制转换 如何返回字符串列表 List<string> emisList = ( from p in subproductTypeyProduct join q in dbEntitiesParams.PARAM_Rule
List<string> emisList = (
from p in subproductTypeyProduct
join q in dbEntitiesParams.PARAM_Rule
on new { p.ProductType, p.SubProductTypeCode }
equals new { ProductType = q.ProductTypeCode, SubProductTypeCode = q.SubProductCode }
select new { q.emis });
无需投影匿名类型。只是简单的字符串。用select q.emis替换select new{q.emis} 无需投影匿名类型。只是简单的字符串。用select q.emis替换select new{q.emis}