class Program{
static void Main(){
test11 jhbee = Program.test; //error
test11 yep = delegate { }; //no error
}
static void test() { }
}
delegate void test11(int r);
So I have the delegate test11
which returns void and takes 1 parameter.
whn I try to assign a parameterless method to an instance of test11
, the compiler, obviously issues an error but when I assign a parameterless anonymous method to an instance of test11
, no error is issued.
I mean, I can see that there is no obstacle for it to work but can you please tell me why is this so? Is there a good reason for this?