Working with Simple Anonymous Delegete Example.

Posted by Rajesh_Kumar under C# category on | Points: 40 | Views : 539
An Anonymous Delegete or anonymous method is a method without a name.It has no return type.An anonymous method uses the keyword,delegate,instead of a method name.
This is followed by the body of the method.

For Example:
delegate int sum_of_two_numbers(int x,int y);

protected void btn_delegate_Click(Object sender,EventArgs e)
sum_of_two_numbers obj = delegate(int x, int y) { return x + y; };


Comments or Responses

Login to post response