Following are the features of anonymous delegate or method:
1. We can access any variable inside the anonymous method which are declared outside of the anonymous method.
2. We use anonymous method when working with event handling
3. An anonymous method when declared without parenthesis can be assigned to a delegate with any signature.
4. Unsafe code can’t be accessed within an anonymous method.
5. An anonymous method can’t access the ref or out parameters of an outer scope.
Asked In: Many Interviews |