Asp.net: Sort generic list with a delegate.

by Pieter Brinkman 10. April 2009 04:57

You can use a delegate to sort a generic list.

Example

GenericList<ObjectItem> = new GenericList<ObjectItem>()

GenericList.Sort(delegate(ObjectItem i1, ObjectItem i2)
{
 return i1.SortProperty.CompareTo(i2.SortProperty);
});

 

Tags: , , ,

ASP.Net

Comments

7/31/2009 9:32:56 AM #

Directory Submission Service

Its always good to learn tips like you share for blog posting. As I just started posting comments for blog and facing problem of lots of rejections. I think your suggestion would be helpful for me. I will let you know if its work for me too.
Thanks and keep post such a informative blogs.

Directory Submission Service United States

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

About Me

My name is Pieter Brinkman I am Solution Architect for Sitecore in The Netherlands. My interests are mainly ASP.NET, MSSQL and Content Management Systems.

Calendar

<<  February 2012  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011

View posts in large calendar

RecentComments

Comment RSS

Most comments