Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/269.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# C从匿名类型中选择字符串列表_C#_Linq_Generics - Fatal编程技术网

C# C从匿名类型中选择字符串列表

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

我有以下LINQ,我需要将结果作为列表返回,但我收到错误:

无法将类型System.Collections.Generic.IEnumerable隐式转换为System.Collections.Generic.List。存在显式转换。是否缺少强制转换

如何返回字符串列表

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}