<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Interview &#187; LINQ</title>
	<atom:link href="http://interview.msdotnetheaven.com/topics/microsoft-net-interview-questions/linq/feed" rel="self" type="application/rss+xml" />
	<link>http://interview.msdotnetheaven.com</link>
	<description>Best place for interview preparation</description>
	<lastBuildDate>Sat, 21 May 2011 21:43:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Define Lambda expressions</title>
		<link>http://interview.msdotnetheaven.com/microsoft-net-interview-questions/linq/define-lambda-expressions.html</link>
		<comments>http://interview.msdotnetheaven.com/microsoft-net-interview-questions/linq/define-lambda-expressions.html#comments</comments>
		<pubDate>Wed, 09 Dec 2009 13:55:02 +0000</pubDate>
		<dc:creator>smartbrain</dc:creator>
				<category><![CDATA[LINQ]]></category>
		<category><![CDATA[interview questions]]></category>
		<category><![CDATA[Lambda Expression]]></category>

		<guid isPermaLink="false">http://interview.msdotnetheaven.com/?p=622</guid>
		<description><![CDATA[A Lambda expression is nothing but an Anonymous Function, can contain expressions and statements. Lambda expressions can be used mostly to create delegates or expression tree types. Lambda expression uses lambda operator => and read as &#8216;goes to&#8217; operator.
Left side of this operator specifies the input parameters and contains the expression or statement block at the right side. 
Example: myExp = myExp/10; 
Now, let see how we can assign the above to a delegate and create an expression tree: 
delegate int myDel(int intMyNum);
        ...


Related posts:<ol><li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/linq/what-is-a-lambda-expression.html' rel='bookmark' title='Permanent Link: What is a Lambda expression?'>What is a Lambda expression?</a></li>
<li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/how-can-i-create-a-singleton-class-by-using-public-constructor.html' rel='bookmark' title='Permanent Link: How can I create a Singleton class by using public constructor?'>How can I create a Singleton class by using public constructor?</a></li>
<li><a href='http://interview.msdotnetheaven.com/crystal-report/difference-between-clone-close-and-dispose-methods-of-crystal-report.html' rel='bookmark' title='Permanent Link: Difference between Clone, Close and Dispose methods of Crystal Report?'>Difference between Clone, Close and Dispose methods of Crystal Report?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>A <strong>Lambda expression</strong> is nothing but an Anonymous Function, can contain expressions and statements. Lambda expressions can be used mostly to create delegates or expression tree types. Lambda expression uses lambda operator => and read as &#8216;goes to&#8217; operator.</p>
<p>Left side of this operator specifies the input parameters and contains the expression or statement block at the right side. </p>
<p><strong>Example: </strong>myExp = myExp/10; </p>
<p>Now, let see how we can assign the above to a delegate and create an expression tree: </p>
<p><code>delegate int myDel(int intMyNum);<br />
        static void Main(string[] args)<br />
        {<br />
            //assign lambda expression to a delegate:<br />
            myDel myDelegate = myExp =&gt; myExp / 10;<br />
            int intRes = myDelegate(110);<br />
            Console.WriteLine("Output {0}", intRes);<br />
            Console.ReadLine();<br />
            //Create an expression tree type<br />
            //This needs System.Linq.Expressions<br />
            Expression&lt;myDel&gt; myExpDel = myExp =&gt; myExp /10;<br />
        }</code></p>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/home/?status=Define+Lambda+expressions+http%3A%2F%2Ftinyurl.com%2F4s2wa3d" title="Post to Twitter"><img class="nothumb" src="http://interview.msdotnetheaven.com/wp-content/plugins/tweet-this/icons/de/twitter/de/tt-twitter-micro4.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Define+Lambda+expressions+http%3A%2F%2Ftinyurl.com%2F4s2wa3d" title="Post to Twitter">Tweet This Post</a></p></div><img src="http://interview.msdotnetheaven.com/?ak_action=api_record_view&id=622&type=feed" alt="" />

<p>Related posts:<ol><li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/linq/what-is-a-lambda-expression.html' rel='bookmark' title='Permanent Link: What is a Lambda expression?'>What is a Lambda expression?</a></li>
<li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/how-can-i-create-a-singleton-class-by-using-public-constructor.html' rel='bookmark' title='Permanent Link: How can I create a Singleton class by using public constructor?'>How can I create a Singleton class by using public constructor?</a></li>
<li><a href='http://interview.msdotnetheaven.com/crystal-report/difference-between-clone-close-and-dispose-methods-of-crystal-report.html' rel='bookmark' title='Permanent Link: Difference between Clone, Close and Dispose methods of Crystal Report?'>Difference between Clone, Close and Dispose methods of Crystal Report?</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://interview.msdotnetheaven.com/microsoft-net-interview-questions/linq/define-lambda-expressions.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is a Lambda expression?</title>
		<link>http://interview.msdotnetheaven.com/microsoft-net-interview-questions/linq/what-is-a-lambda-expression.html</link>
		<comments>http://interview.msdotnetheaven.com/microsoft-net-interview-questions/linq/what-is-a-lambda-expression.html#comments</comments>
		<pubDate>Tue, 13 Oct 2009 12:51:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[LINQ]]></category>
		<category><![CDATA[Expression tree]]></category>
		<category><![CDATA[Lambda Expression]]></category>

		<guid isPermaLink="false">http://interview.msdotnetheaven.com/?p=618</guid>
		<description><![CDATA[A Lambda expression is nothing but an Anonymous Function, can contain expressions and statements. Lambda expressions can be used mostly to create delegates or expression tree types. Lambda expression uses lambda operator =&#62; and read as &#8216;goes to&#8217; operator.
Left side of this operator specifies the input parameters and contains the expression or statement block at the right side.
Example: myExp = myExp/10;
Now, let see how we can assign the above to a delegate and create an expression tree:
delegate int myDel(int intMyNum);
static void Main(string[] args)
{
//assign lambda expression to a delegate:
myDel myDelegate = ...


Related posts:<ol><li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/linq/define-lambda-expressions.html' rel='bookmark' title='Permanent Link: Define Lambda expressions'>Define Lambda expressions</a></li>
<li><a href='http://interview.msdotnetheaven.com/mainframe-question-and-answers/mainframe-jcl-question-answer/what-is-the-meaning-of-data-definition-name-ddname-and-dataset-name-dsname-in-the-dd-statement.html' rel='bookmark' title='Permanent Link: What is the meaning of data definition name (ddname) and dataset name (dsname) in the DD statement?'>What is the meaning of data definition name (ddname) and dataset name (dsname) in the DD statement?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">A Lambda expression is nothing but an Anonymous Function, can contain expressions and statements. Lambda expressions can be used mostly to create delegates or expression tree types. Lambda expression uses lambda operator =&gt; and read as &#8216;goes to&#8217; operator.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Left side of this operator specifies the input parameters and contains the expression or statement block at the right side.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Example: myExp = myExp/10;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Now, let see how we can assign the above to a delegate and create an expression tree:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">delegate int myDel(int intMyNum);</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">static void Main(string[] args)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">{</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//assign lambda expression to a delegate:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">myDel myDelegate = myExp =&gt; myExp / 10;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">int intRes = myDelegate(110);</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Console.WriteLine(&#8220;Output {0}&#8221;, intRes);</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Console.ReadLine();</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Create an expression tree type</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//This needs System.Linq.Expressions</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Expression&lt;myDel&gt; myExpDel = myExp =&gt; myExp /10;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">}</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Note:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">The =&gt; operator has the same precedence as assignment (=) and is right-associative.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Lambdas are used in method-based LINQ queries as arguments to standard query operator methods such as Where.</div>
<p>A Lambda expression is nothing but an Anonymous Function, can contain expressions and statements. Lambda expressions can be used mostly to create delegates or expression tree types. Lambda expression uses lambda operator =&gt; and read as &#8216;goes to&#8217; operator.</p>
<p>Left side of this operator specifies the input parameters and contains the expression or statement block at the right side.</p>
<p>Example: Â myExp = myExp/10;</p>
<p>Now, let see how we can assign the above to a delegate and create an expression tree:</p>
<blockquote><p>delegate int myDel(int intMyNum);</p>
<p>static void Main(string[] args)</p>
<p>{</p>
<p>//assign lambda expression to a delegate:</p>
<p>myDel myDelegate = myExp =&gt; myExp / 10;</p>
<p>int intRes = myDelegate(110);</p>
<p>Console.WriteLine(&#8220;Output {0}&#8221;, intRes);</p>
<p>Console.ReadLine();</p>
<p>//Create an expression tree type</p>
<p>//This needs System.Linq.Expressions</p>
<p>Expression&lt;myDel&gt; myExpDel = myExp =&gt; myExp /10;</p>
<p>}</p></blockquote>
<p><strong><span style="text-decoration: underline;">Note:</span></strong></p>
<p>The =&gt; operator has the same precedence as assignment (=) and is right-associative.</p>
<p>Lambdas are used in method-based LINQ queries as arguments to standard query operator methods such as Where.</p>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/home/?status=What+is+a+Lambda+expression%3F+http%3A%2F%2Ftinyurl.com%2F4vo7hoh" title="Post to Twitter"><img class="nothumb" src="http://interview.msdotnetheaven.com/wp-content/plugins/tweet-this/icons/de/twitter/de/tt-twitter-micro4.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=What+is+a+Lambda+expression%3F+http%3A%2F%2Ftinyurl.com%2F4vo7hoh" title="Post to Twitter">Tweet This Post</a></p></div><img src="http://interview.msdotnetheaven.com/?ak_action=api_record_view&id=618&type=feed" alt="" />

<p>Related posts:<ol><li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/linq/define-lambda-expressions.html' rel='bookmark' title='Permanent Link: Define Lambda expressions'>Define Lambda expressions</a></li>
<li><a href='http://interview.msdotnetheaven.com/mainframe-question-and-answers/mainframe-jcl-question-answer/what-is-the-meaning-of-data-definition-name-ddname-and-dataset-name-dsname-in-the-dd-statement.html' rel='bookmark' title='Permanent Link: What is the meaning of data definition name (ddname) and dataset name (dsname) in the DD statement?'>What is the meaning of data definition name (ddname) and dataset name (dsname) in the DD statement?</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://interview.msdotnetheaven.com/microsoft-net-interview-questions/linq/what-is-a-lambda-expression.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

