Click here to Skip to main content
15,907,001 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Error:
long? does not contains defintion for extension method best extension overload method Querable.conatains<long?>


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


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?>


C#
var _OrderResponse = (await _tagProvider.GetBaseOrderAsync(new GetBaseOrderRequest() { })).BaseObjects.Where(b => b.CustomerId.Contains(request.customerId)).ToList();
Posted
Updated 27-Nov-18 2:26am

Contains() only applies to strings not numbers.

Try b => b.CustomerId == request.customerId
 
Share this answer
 
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[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900