Re: anonymous function/delegate usage

2009-11-12 Thread Sam Hu
BCS Wrote: > If the function has no args the first () can be dropped. > If the return type can be inferred, that can be dropped. > Nested functions can access vars in the outer function. > Got it.Thanks a lot!

Re: anonymous function/delegate usage

2009-11-12 Thread BCS
Hello Sam, Don Wrote: You need to call the delegate you've made. I missed this key point. So to summary: int a=1; int b=2; 1.nested function; 2.int c=(int a,int b){return a+b;}(a,b); 3.int c=(int,int){return a+b;}(a,b); 4.int c=(){return a+b;}(); 5.int c={return a+b;}(); How come the last o

Re: anonymous function/delegate usage

2009-11-12 Thread Sam Hu
Don Wrote: > You need to call the delegate you've made. I missed this key point. So to summary: int a=1; int b=2; 1.nested function; 2.int c=(int a,int b){return a+b;}(a,b); 3.int c=(int,int){return a+b;}(a,b); 4.int c=(){return a+b;}(); 5.int c={return a+b;}(); How come the last one is legal?