Skip to content

Instantly share code, notes, and snippets.

@yetanotherchris
Created February 11, 2013 20:20
Show Gist options
  • Save yetanotherchris/4757270 to your computer and use it in GitHub Desktop.
Save yetanotherchris/4757270 to your computer and use it in GitHub Desktop.
IComparer example
List<ContentItem> list = N2.Context.CurrentPage.Children.ToList<ContentItem>();
list.Sort(delegate(ContentItem x, ContentItem y)
{
if (string.IsNullOrEmpty(x.Title))
return 1;
else if (string.IsNullOrEmpty(y.Title))
return -1;
return x.Title.CompareTo(y.Title);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment