获取错误:无法将lambda表达式转换为type [英] Getting Error : Cannot convert lambda expression to type

查看:113
本文介绍了获取错误:无法将lambda表达式转换为type的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有两个winform应用程序,如app1和app2非常相似,代码也非常相似。我从app1到app2复制了一些表单和代码,然后在编译时我开始得到以下错误。

I have two winform application like app1 and app2 which are very similar and code also very similar. i copied few forms and code from app1 to app2 and when compile then i started getting below error.



错误      1061&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;无法将lambda表达式转换为类型'System.Collections.Generic。 IEqualityComparer< RDSS _ Workbench.QcVerticalViewNew。 QcVerticalViewNewProcess。 TickerBrokerStandardDateLineit emValue>'
因为它不是委托类型  &NBSP; &NBSP;  
  &NBSP; &NBSP;  

Error      1061       Cannot convert lambda expression to type 'System.Collections.Generic.IEqualityComparer<RDSS_Workbench.QcVerticalViewNew.QcVerticalViewNewProcess.TickerBrokerStandardDateLineitemValue>' because it is not a delegate type               


 


 这是错误抛出的代码

 this is the code from where error was throwing

  
var TickerBrokerStandardDateLineitemValueAllBrokerBogeyDistinct = (from data1 in allTickerBrokerStandardDateLineitemValue2

   select new TickerBrokerStandardDateLineitemValue

   {

       TabName = data1.TabName,

       StandardLineItem = data1.StandardLineItem,

       BRTab = "",

       BRLineItem = "",

       Action = "",

       StandardValue = "",

       BrokerName = data1.BrokerName,

       CalValue = "",

   }).DistinctBy(x => new { x.TabName, x.StandardLineItem, x.BrokerName }).ToList();



var resultNotPersentInAllBrokerBogey = StandardBorgeyForEachBroker.Except(TickerBrokerStandardDateLineitemValueAllBrokerBogeyDistinct, (x, y) => x.TabName.Equals(y.TabName)

&& x.StandardLineItem.Equals(y.StandardLineItem)

&& x.BrokerName.Equals(y.BrokerName)).DistinctBy(x => new { x.TabName, x.StandardLineItem, x.BrokerName }).ToList();



allTickerBrokerStandardDateLineitemValue2.AddRange(resultNotPersentInAllBrokerBogey);






这下面的行实际上是在抛出错误

this below line was throwing error actually

var resultNotPersentInAllBrokerBogey = StandardBorgeyForEachBroker.Except

(TickerBrokerStandardDateLineitemValueAllBrokerBogeyDistinct,(x,y) => x.TabName.Equals(y.TabName)

&& x.StandardLineItem.Equals(y.StandardLineItem)

&& x.BrokerName .Equals(y.BrokerName))。DistinctBy(x => new

(TickerBrokerStandardDateLineitemValueAllBrokerBogeyDistinct, (x, y) => x.TabName.Equals(y.TabName) && x.StandardLineItem.Equals(y.StandardLineItem) && x.BrokerName.Equals(y.BrokerName)).DistinctBy(x => new

{x.TabName,x.StandardLineItem,x.BrokerName})。ToList();

{ x.TabName, x.StandardLineItem, x.BrokerName }).ToList();


此行显示红色  (x,y)

this line showing squiggle red (x, y)

我真的不明白app2中缺少的导致此错误的相同代码在app1中正常工作。所以任何人都可以告诉我我错过了什么?

i really do not understand what was missing in app2 which was causing this error the same code was working fine in app1. so anyone can tell me what i was missing ?

请帮助我排序错误。

推荐答案

您好Sudip_inn,

Hi Sudip_inn,

感谢您在此发帖。

对于您的问题,您提供的代码无法重现错误。请检查定义,我猜您定义的内容与您调用的类型不同。

For your question, the code you provided could not reproduce the error. Please check the definition, I guess you define something which is different with the type you call it.

如果可能,您能在app2和app1中提供代码吗?

If it is possible, could you provide the code in app2 and app1?

最好的问候,

Wendy


这篇关于获取错误:无法将lambda表达式转换为type的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆