events vs. delegates

  • Thread starter Thread starter cody
  • Start date Start date
C

cody

Why do I have to create new objects implementing IComparer when we can use
delegates?

class Test
{

int CompareStuff(int a, int b)
{
return a-b;
}

void Foo()
{
// in .NET framework 2.0 we could simply write
//Array.Sort(CompareStuff);
// since delegates are implicitly created
Array.Sort(myArray, new ComparerDelegate(CompareStuff));
}

}
 
Crap, forget my whole post. I tried it and it already worked that way in VS
2005.
I really should go to bed now :)
The question now is: Why doesn't intellisense show me the overload which
takes Comparison<T> as parameter?
 
Back
Top