c# list comparer use two compare elements

Posted by senzacionale on Stack Overflow See other posts from Stack Overflow or by senzacionale
Published on 2010-03-08T04:49:58Z Indexed on 2010/03/08 4:51 UTC
Read the original article Hit count: 191

Filed under:
private class CompAdvertisements : IComparer<Advertisements>
{
private string OrderBy { get; set; }

public CompAdvertisements(string orderBy)
{
OrderBy = orderBy;
}

#region IComparer<Advertisements> Members

public int Compare(Advertisements x, Advertisements y)
{
return x.Country.Name.CompareTo(y.Country.Name);

Can i also user x.Name.CompareTo(y.Name); in comparer that i will compare with two elements lik order by something and order by something2

© Stack Overflow or respective owner

Related posts about c#