运算符'=='不能应用于'igrouping< string,problemsandproceduresmodel>类型的操作数。 '和'字符串'? [英] Operator '==' cannot be applied to operands of type 'igrouping<string, problemsandproceduresmodel> ' and 'string'?

查看:123
本文介绍了运算符'=='不能应用于'igrouping< string,problemsandproceduresmodel>类型的操作数。 '和'字符串'?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经写了以下一行来获取独特的snomed代码,但得到上面提到的错误。



任何人都可以帮助我。



i have written the following line to get unique snomed codes but getting the above error mentioned in question.

anybody can help me out.

returnOperationResult.Data = returnList.Where(x => !currentAndFullProblemsProcedures.Any(e => e == x.ProblemSnomedCode));





我尝试过:



1)returnOperationResult.Data = returnList.Where(x =>!currentAndFullProblemsProcedures.Any(e => ; e == x.ProblemSnomedCode()));

2)returnOperationResult.Data = returnList.Where(x =>!currentAndFullProblemsProcedures.Any(e => e == x.ProblemSnomedCode。修剪));

3)returnOperationResult.Data = returnList.Where(x =>!currentAndFullProblemsProcedures.Any(e => Convert.ToString(e)== x.ProblemSnomedCode));

4)returnOperationResult.Data = returnList.Where(x =>!currentAndFullPr oblemsProcedures.Any(e => e == x.ProblemSnomedCode).ToString());



What I have tried:

1)returnOperationResult.Data = returnList.Where(x => !currentAndFullProblemsProcedures.Any(e => e == x.ProblemSnomedCode()));
2) returnOperationResult.Data = returnList.Where(x => !currentAndFullProblemsProcedures.Any(e => e == x.ProblemSnomedCode.Trim));
3) returnOperationResult.Data = returnList.Where(x => !currentAndFullProblemsProcedures.Any(e => Convert.ToString(e) == x.ProblemSnomedCode));
4) returnOperationResult.Data = returnList.Where(x => !currentAndFullProblemsProcedures.Any(e => e == x.ProblemSnomedCode).ToString());

推荐答案

错误只是说 e 不是一个字符串,当你这样做时不能与一个字符串进行比较:

The error is simply saying that e is not a string, and can't be compared to one when you do this:
...ures.Any(e => e == x.ProblemSnomedCode)



等式测试的右侧是一个字符串(或者您的其他努力不会编译)但您需要查看 currentAndFullProblemsProcedures 集合的类型,以确定您尝试使用的字符串属性。请记住,Any会对集合进行迭代,因此您需要查看集合中的项目,而不是尝试使用项目本身。


The right hand side of the equality test is a string (or your other efforts wouldn't compile) but you need to look at the type of the currentAndFullProblemsProcedures collection to decide what string property you are trying to work with. Remember that Any iterates the collection, so you need to look at what items the collection holds rather than try to use the item itself.


问题出在该语句中: e == x.ProblemSnomedCode()

e 的类型为 ProblemsAndProceduresModel



x.ProblemSnomedCode 的类型为 string



为了能够比较它们,您必须在 e <之后添加对应的字段/方法来更改它们/ code>,例如: e.CurrentSnomedCode == x.ProblemSnomedCode()
The problem is in that statement: e == x.ProblemSnomedCode().
e is type of ProblemsAndProceduresModel
and
x.ProblemSnomedCode is type of string.

To be able to compare them, you have to change it by adding correspoding field/method after e, for example: e.CurrentSnomedCode == x.ProblemSnomedCode()


这篇关于运算符'=='不能应用于'igrouping&lt; string,problemsandproceduresmodel&gt;类型的操作数。 '和'字符串'?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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