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
C# 对象必须在linq查询中实现IConvertible错误才能选择两行_C#_Asp.net Mvc_Linq - Fatal编程技术网

C# 对象必须在linq查询中实现IConvertible错误才能选择两行

C# 对象必须在linq查询中实现IConvertible错误才能选择两行,c#,asp.net-mvc,linq,C#,Asp.net Mvc,Linq,我有一个Excel工作表,我需要获取两列值-我已经编写了一个Linq查询- 错误: 在第行检测到contextSwitchDeadLock错误 查询: select new { Description = typeDescription.Description , VehicleKey = typeDescription.VehicleKey }); 如何修复此错误?我想从同一个Excel工作表中从单个linq查询中获取两个coulmns值。我认为这是由于空值造成的 像这样试试 select

我有一个Excel工作表,我需要获取两列值-我已经编写了一个Linq查询-

错误:

在第行检测到contextSwitchDeadLock错误

查询:

select new { Description = typeDescription.Description ,
VehicleKey = typeDescription.VehicleKey });

如何修复此错误?我想从同一个Excel工作表中从单个linq查询中获取两个coulmns值。

我认为这是由于空值造成的

像这样试试

select new { Description = Convert.ToString(typeDescription.Description) , 
    VehicleKey = Convert.ToString(typeDescription.VehicleKey) });