W
Wiktor Zychla
Hello,
I wonder why the delegate declaration needs named parameters?
public delegate void MyDelegate( int a, int b ); // ok
public delegate void MyDelegate( int, int ); // compiler error
C allows to define both:
typedef void (*MyDelegate)(int); // ok
typedef void (*MyDelegate)(int a); // ok
in fact, the delegates are only signatures, so the names should be
irrelevant. it could be even more elegant to use nameless signatures,
because now it looks rather confusing:
public delegate void MyDelegate( int a, int b ); // names: a, b
public void a_Method( int x, int y ) {} // names: x, y
.... MyDelegate m = new MyDelegate( a_Method ); // ok, but there's slight
confusion
while it could be:
public delegate void MyDelegate( int, int ); // a signature only
public void a_Method( int x, int y ) {} // names: x, y
.... MyDelegate m = new MyDelegate( a_Method );
thanks in advance for enlightening me,
Wiktor Zychla
I wonder why the delegate declaration needs named parameters?
public delegate void MyDelegate( int a, int b ); // ok
public delegate void MyDelegate( int, int ); // compiler error
C allows to define both:
typedef void (*MyDelegate)(int); // ok
typedef void (*MyDelegate)(int a); // ok
in fact, the delegates are only signatures, so the names should be
irrelevant. it could be even more elegant to use nameless signatures,
because now it looks rather confusing:
public delegate void MyDelegate( int a, int b ); // names: a, b
public void a_Method( int x, int y ) {} // names: x, y
.... MyDelegate m = new MyDelegate( a_Method ); // ok, but there's slight
confusion
while it could be:
public delegate void MyDelegate( int, int ); // a signature only
public void a_Method( int x, int y ) {} // names: x, y
.... MyDelegate m = new MyDelegate( a_Method );
thanks in advance for enlightening me,
Wiktor Zychla