IList .. No Sort ?

  • Thread starter Thread starter sloan
  • Start date Start date
S

sloan

List<string> sss = new List<string>();

sss.Add("z");

sss.Add ("b");

sss.Add ("m");

sss.Add("a");

sss.Sort();

IList<string> isss = sss as IList<string>;

if (null != isss)

{

//isss.Sort(); // does not exist

}





Is the .Sort a part of any Interface definition? Or is it just tacked onto
the List.

I guess I was just surprised when I saw IList doesn't have a .Sort method.

I went thru MSDN documenation for a while, and couldn't find a match.

..................
 
sloan,

Nope, the IList interface does not have a sort mechanism. It's easy
enough to write a generic one though, that takes an IList and then sorts the
contents into a new IList.
 
Back
Top