Error CS1929 'int[]' does not contain a definition for 'Contains' and the best extension method overload 'Queryable.Contains(IQueryable, int?)' requires a receiver of type 'IQueryable
once i try to run the code this error comes out , i dont know how to fix it. this is the code
public void SendModelPallet(string IDs, StorageContext db)
{
int[] ids = ViewModelsUtils.processIDs(IDs);
PalletBoxes = db.ExternStoragePlaces.Where(c => ids.Contains(c.PalletPlaceID)).ToList();
this.db = db;
}
Thanks in advance
Just a guess here, but I remember having had problems with nulll coalescing in some Linq to SQL queries. I recommend you to try to declare your ids array as this :
int?[] ids = ViewModelsUtils.processIDs(IDs);
(use int?[]
instead of int[]
so this will match the type of your field)
Not sure about this, first because it doesn't seem to match the compilation error message, and secondly because I don't have a way to test this for the moment.
Had the same issue while using Delegates[] and used to get the CS1929: 'Delegate?[]' does not contain a definition for 'Contains'
Just included the System.Linq
namespace and works fine now.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.