IList .. No Sort ?

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.

..................
 
N

Nicholas Paldino [.NET/C# MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top