标签:reac card gen string main deb linq length ++
private void TestPostData() { string all = ""; List<int> listTimeCard = new List<int>() {1,4,3,4,5,76,4,3,2,3,5 ,766,7}; int pageSize = 2; int pageNum = 0; while (pageNum*pageSize <listTimeCard.Count()) { var batchData = listTimeCard.Skip(pageSize *pageNum ).Take(pageSize); string s = JsonConvert.SerializeObject(batchData); all += s; Debug.WriteLine(""+s); pageNum++; } }
其他例子:
class Program { static int Main() { //每页条数 const int pageSize = 2; //页码 0也就是第一条 int pageNum = 0; //源数据 string[] names = { "刘一","陈二","张三","李四","王五","赵六","孙七","周八","吴九" }; while (pageNum * pageSize < names.Length) { //分页 var query = names.Skip(pageNum * pageSize).Take(pageSize); Console.WriteLine("输出第{0}页记录", pageNum + 1); //输出每页内容 foreach (var q in query) { Console.WriteLine(q); } pageNum++; } Console.ReadKey(); return 0; } }
标签:reac card gen string main deb linq length ++
原文地址:https://www.cnblogs.com/wgscd/p/13086419.html