如何在Linq中使用Long类型跳过
如何在Linq中使用Skip的long类型(Int64)。 它仅支持Int32。
dataContext.Persons.Skip(LongNumber);
你可以使用while循环:
// Some init List persons = new List (); List resultList = persons; long bigNumber = 3 * (long)int.MaxValue + 12; while (bigNumber > int.MaxValue) { resultList = resultList.Skip(int.MaxValue).ToList(); bigNumber -= int.MaxValue; } resultList = resultList.Skip(int.MaxValue).ToList(); // Then what do what you want with this result list
但是你的集合有多于int.MaxValue
条目吗?