I see that lambda expressions have become a very useful tool at some points in the language. I use them a lot, and most of the time they fit very nicely and make the code shorter and perhaps more clear.
Now .. I have seen some, I would say, overuse of them. Some people like them so much that they try to use them wherever they can. Sometimes C # code looks like a functional language.
Other factors are the costs associated with lambda reflection, and which are not debug friendly.
I would like to hear opinions on how well and how clearly the code is to use more or less lambda expressions.
(this is not a good example, but let it be a trigger)
I wrote the following code. Using delegate { return null; } delegate { return null; } helps me avoid having to ask if the event is null or not every time I have to use it.
public delegate ContactCellInfo.Guest AddGuest(); public event AddGuest GuestRequest = delegate { return null;}
Im using resharper and wise resharper (even if he literally eats memory several times) made me the following suggestion
public delegate ContactCellInfo.Guest AddGuest(); public event AddGuest GuestRequest = () => null;
From my point of view, the code using the delegate looks more understandable. I am not opposed to expressing Lamdba, I just would like to hear some tips on how and when to use them.
source share