List 객체 Sorting하기
2013. 1. 31. 20:33ㆍProgramming/C#
의외로 많이 쓰는데, 막상 쓸려면 어떻게 썼나 생각이 안나는 코딩 중에 하나!
아래와 같은 템플릿으로 사용하면 된다!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void Sorting(List<Test> list1) | |
{ | |
list1.Sort(delegate(Test test1, Test test2) | |
{ | |
return test1.DocLocation.CompareTo(test2.DocLocation); | |
}); | |
} |