'페이징'에 해당되는 글 1건

  1. 2016.07.06 Page 기능을 구현할때는 Linq Skip을 활용하자.
c#2016. 7. 6. 13:41

Linq가 없는 시절  페이징 할려면 


private List<Data> MakePhotoList(int startCount)
{
var tempPhotoList = new List<Data>();
int maxCount = startCount + 9;
for (int i = startCount; startCount < maxCount; startCount++)
{
tempPhotoList.Add(_photoList[i]);
}
return tempPhotoList;
}


이런식으로 해야만 했다.

하지만 Linq가 있으면

_photoList.Skip(startCount).Take(9).ToList();

한줄로 끝~


'c#' 카테고리의 다른 글

사용하지 않을 메소드앞에 [Obsolete] 어트리뷰트 사용  (0) 2020.01.03
list 삭제  (0) 2019.08.02
URI Parameter 붙이기  (0) 2016.06.20
RenderTargetBitmap Memory Leak 해결  (0) 2016.04.20
Simple Uniq ID만들기  (0) 2016.04.20
Posted by 동동(이재동)