More than 5 years have passed since last update.
概要
Linqを使うと、あら不思議。
var pages = collection
.Skip(itemsInPage)
.Count()
;
ここで
- pages: 総ページ数
- collection: 全要素含むコレクション
- itemsInPage: 1ページ内の要素数
説明(見たまんまだけど・・・)
Skip(itemsInPage)で各ページの先頭要素が取れるので、それを数え上げれば、ページ数っていう仕組み。
Why not register and get more from Qiita?
- We will deliver articles that match you
By following users and tags, you can catch up information on technical fields that you are interested in as a whole
- you can read useful information later efficiently
By "stocking" the articles you like, you can search right away
Sign upLogin