如何在Linq中使用Long类型跳过 [英] How use Long type for Skip in Linq
本文介绍了如何在Linq中使用Long类型跳过的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在Linq中将长类型(Int64)与Skip一起使用.它仅支持Int32.
How I can use long type (Int64) with Skip in Linq. It support only Int32.
dataContext.Persons.Skip(LongNumber);
推荐答案
您可以使用while循环:
You can use a while loop:
// Some init
List<Person> persons = new List<Person>();
List<Person> 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
个条目?
But does your collection have more than int.MaxValue
entries?
这篇关于如何在Linq中使用Long类型跳过的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文