Lambda Expression Basics


2,000 Things You Should Know About C#

A lambda expression is an unnamed method that appears in-line in the code where it used.  It can be used wherever your code expects an instance of a delegate.

Below, the lambda expression takes the place of a method name in assigning a value to a delegate instance.  The in-line expression behaves exactly as the method does, returning a string constructed from two input parameters (int and double).

In either case, we can invoke the code (named method or lambda expression) by invoking the delegate instance and passing it the input parameters.

View original post

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s