长?不包含扩展方法的最佳扩展重载方法querable.conatains< long? > [英] Long? Does not contains defintion for extension method best extension overload method querable.conatains<long? >

查看:332
本文介绍了长?不包含扩展方法的最佳扩展重载方法querable.conatains< long? >的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误:

多长?不包含扩展方法的定义最佳扩展重载方法Querable.conatains< long?>





Error:
long? does not contains defintion for extension method best extension overload method Querable.conatains<long?>


var _OrderResponse = (await _tagProvider.GetBaseOrderAsync(new GetBaseOrderRequest() { })).BaseObjects.Where(b => b.CustomerId.Contains(request.customerId)).ToList();





请帮帮我。

谢谢你



我的尝试:



错误:

多长?不包含扩展方法的定义最佳扩展重载方法Querable.conatains< long?>







Please help me.
Thank u

What I have tried:

Error:
long? does not contains defintion for extension method best extension overload method Querable.conatains<long?>


var _OrderResponse = (await _tagProvider.GetBaseOrderAsync(new GetBaseOrderRequest() { })).BaseObjects.Where(b => b.CustomerId.Contains(request.customerId)).ToList();

推荐答案

包含()仅适用于字符串而非数字。



尝试 b => b.CustomerId == request.customerId
Contains() only applies to strings not numbers.

Try b => b.CustomerId == request.customerId


包含适用于集合和字符串(字符集合)。

A long不能直接通过 foreach 或使用Linq方法迭代,因为它不是集合并且不实现IEnumerable接口: Enumerable.Contains Method(System.Linq)| Microsoft Docs [ ^ ]
Contains applies to collections and strings (which are collections of characters).
A long cannot be iterated over either directly via a foreach or by using Linq methods as it is not a collection and does not implement the IEnumerable interface: Enumerable.Contains Method (System.Linq) | Microsoft Docs[^]


这篇关于长?不包含扩展方法的最佳扩展重载方法querable.conatains&lt; long? &GT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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