tag:blogger.com,1999:blog-70788211918250254992024-03-13T20:01:36.285-07:00Microsoft TechnologiesDivyesh Lappawalahttp://www.blogger.com/profile/13762323603816502055noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-7078821191825025499.post-41251037173273102942015-09-04T22:06:00.001-07:002015-09-04T22:06:48.314-07:00Working with SharePoint Lists though Client Object Model<div dir="ltr" style="text-align: left;" trbidi="on">
<b><span style="font-family: Arial, Helvetica, sans-serif;">How to get SharePoint List Items through SharePoint Client Object Model</span></b><br />
<div>
<b><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></b>
<br />
<ul>
<li><b><span style="font-family: Arial, Helvetica, sans-serif;">Iterate List Items</span></b></li>
</ul>
<div>
<pre style="background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMJp6fnAMIGCIARwOhuoK9vcK07VGYVOYbYUM9Q1yLUg3OSlWUy2rCyo8MuCmuPfkDyFeEuJK4oMhNJV4BWdpeBp0m5DluWhoNMiOxhB5Bxk_W2s1tX2sVW2ZvcmN5PZwTkpT2MkcwEk_z/s320/codebg.gif) rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 450.828125px;"><code style="word-wrap: normal;">ClientContext clientContext = new ClientContext("Site URL");
NetworkCredential Cred = new NetworkCredential("UserName", "Password", "Domain");
clientContext.Credentials = Cred;
Web web = clientContext.Web;
Microsoft.SharePoint.Client.List lst = clientContext.Web.Lists.GetByTitle("List Name");
ListCollection fieldList = web.Lists;
clientContext.Load(fieldList);
// Execute the query to the server.
clientContext.ExecuteQuery();
foreach (Microsoft.SharePoint.Client.List lstobj in fieldList)
{
Console.WriteLine("\n"+"Title:" + lstobj.Title);
Console.WriteLine("Description:" + lstobj.Description);
Console.WriteLine("Created:" + lstobj.Created);
Console.WriteLine("\n");
}
Console.ReadLine(); </code></pre>
</div>
</div>
<div>
<ul style="text-align: left;">
<li><b><span style="font-family: Arial, Helvetica, sans-serif;">SharePoint List Item count</span></b></li>
</ul>
<div>
<pre style="background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMJp6fnAMIGCIARwOhuoK9vcK07VGYVOYbYUM9Q1yLUg3OSlWUy2rCyo8MuCmuPfkDyFeEuJK4oMhNJV4BWdpeBp0m5DluWhoNMiOxhB5Bxk_W2s1tX2sVW2ZvcmN5PZwTkpT2MkcwEk_z/s320/codebg.gif) rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 450.828125px;"><code style="word-wrap: normal;">ClientContext clientContext = new ClientContext("Site URL");
NetworkCredential Cred = new NetworkCredential("UserName", "Password", "Domain");
clientContext.Credentials = Cred;
Web web = clientContext.Web;
Microsoft.SharePoint.Client.List lst = clientContext.Web.Lists.GetByTitle("List Name");
clientContext.Load(lst);
clientContext.ExecuteQuery();
int cnt = lst.ItemCount;
Console.WriteLine(cnt);
Console.ReadLine(); </code></pre>
</div>
<div>
<pre style="background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMJp6fnAMIGCIARwOhuoK9vcK07VGYVOYbYUM9Q1yLUg3OSlWUy2rCyo8MuCmuPfkDyFeEuJK4oMhNJV4BWdpeBp0m5DluWhoNMiOxhB5Bxk_W2s1tX2sVW2ZvcmN5PZwTkpT2MkcwEk_z/s320/codebg.gif) rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 450.828125px;"><ul style="text-align: left;">
</ul>
</pre>
<pre style="background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMJp6fnAMIGCIARwOhuoK9vcK07VGYVOYbYUM9Q1yLUg3OSlWUy2rCyo8MuCmuPfkDyFeEuJK4oMhNJV4BWdpeBp0m5DluWhoNMiOxhB5Bxk_W2s1tX2sVW2ZvcmN5PZwTkpT2MkcwEk_z/s320/codebg.gif) rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 450.828125px;"></pre>
</div>
</div>
</div>
Divyesh Lappawalahttp://www.blogger.com/profile/13762323603816502055noreply@blogger.com0tag:blogger.com,1999:blog-7078821191825025499.post-26608285911773844922015-04-12T03:43:00.001-07:002015-04-12T03:43:50.522-07:00How to get SharePoint List Content Type Through CSOM - Client Object Model<div dir="ltr" style="text-align: left;" trbidi="on">
How to get Content Type of particular list.<br />
<div>
<br /></div>
<div>
Code:</div>
<div>
<br /></div>
<div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<pre style="background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMJp6fnAMIGCIARwOhuoK9vcK07VGYVOYbYUM9Q1yLUg3OSlWUy2rCyo8MuCmuPfkDyFeEuJK4oMhNJV4BWdpeBp0m5DluWhoNMiOxhB5Bxk_W2s1tX2sVW2ZvcmN5PZwTkpT2MkcwEk_z/s320/codebg.gif) rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 450.828125px;"><code style="word-wrap: normal;">ClientContext clientContext = new ClientContext("Site URL");
String strPassword = "Password";
var passWord = new SecureString();
foreach (var c in strPassword.ToCharArray()) passWord.AppendChar(c);
NetworkCredential Cred = new NetworkCredential("Username", passWord, "Domain");
clientContext.Credentials = Cred;
ContentTypeCollection contentTypeColl = clientContext.Web.Lists.GetByTitle("ContetType Name").ContentTypes;
clientContext.Load(contentTypeColl);
clientContext.ExecuteQuery();
//// Display the Content Type name
foreach (ContentType ct in contentTypeColl)
{
Console.WriteLine(ct.Name);
}
Console.ReadLine(); </code></pre>
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<blockquote class="tr_bq">
<br /></blockquote>
</div>
</div>
</div>
Divyesh Lappawalahttp://www.blogger.com/profile/13762323603816502055noreply@blogger.com0tag:blogger.com,1999:blog-7078821191825025499.post-54884085542154661412015-04-09T18:17:00.002-07:002015-04-09T18:19:08.550-07:00How to access Web Site through SharePoint Client Object Model<div dir="ltr" style="text-align: left;" trbidi="on">
You can access WebSite Properties through SharePoint Client Object Model.<div>
Microsoft.SharePoint.Client should be use.<br /><div>
<br /></div>
<div>
<br /></div>
<div>
Code: </div>
<div>
<div class="MsoNormal">
<span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-highlight: white;">ClientContext</span><span style="background: white; font-family: Consolas; font-size: 9.5pt; line-height: 107%;"> clientContext = </span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-highlight: white;">new</span><span style="background: white; font-family: Consolas; font-size: 9.5pt; line-height: 107%;"> </span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-highlight: white;">ClientContext</span><span style="background: white; font-family: Consolas; font-size: 9.5pt; line-height: 107%;">("</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-highlight: white;">Site URL"</span><span style="background: white; font-family: Consolas; font-size: 9.5pt; line-height: 107%;">);</span><span style="font-family: Consolas; font-size: 9.5pt; line-height: 107%;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">NetworkCredential</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;"> Cred = </span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">new</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;"> </span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">NetworkCredential</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;">(</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">"UserName"</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;">, <span style="color: #a31515; font-size: 12.6666669845581px;">"Password"</span>, </span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">"Domain"</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;">);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; font-family: Consolas; font-size: 9.5pt;">clientContext.Credentials
= Cred;<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-highlight: white;">Web</span><span style="background: white; font-family: Consolas; font-size: 9.5pt; line-height: 107%;"> web = clientContext.Web;</span><span style="font-family: Consolas; font-size: 9.5pt; line-height: 107%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="background: white; font-family: Consolas; font-size: 9.5pt; line-height: 107%;">clientContext.Load(web);</span><span style="font-family: Consolas; font-size: 9.5pt; line-height: 107%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; font-family: Consolas; font-size: 9.5pt; line-height: 107%;">clientContext.ExecuteQuery();</span><span style="font-family: Consolas; font-size: 9.5pt; line-height: 107%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">Console</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;">.WriteLine(</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">"Title:"</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;"> + web.Title);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">Console</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;">.WriteLine(</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">"Description:"</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;"> + web.Description);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">Console</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;">.WriteLine(</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">"Created:"</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;"> + web.Created);<o:p></o:p></span></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal">
<span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-highlight: white;">onsole</span><span style="background: white; font-family: Consolas; font-size: 9.5pt; line-height: 107%;">.ReadLine();</span><span style="font-family: Consolas; font-size: 9.5pt; line-height: 107%;"><o:p></o:p></span></div>
<br />
<br />
<br />
If you want to access only specific properties from WebSite, it can be achieved using LINQ.<br />
<br />
Code:<br />
<br />
<div class="MsoNormal">
<span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; line-height: 13.5533332824707px;">ClientContext</span><span style="background: white; font-family: Consolas; font-size: 9.5pt; line-height: 13.5533332824707px;"> clientContext = </span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 13.5533332824707px;">new</span><span style="background: white; font-family: Consolas; font-size: 9.5pt; line-height: 13.5533332824707px;"> </span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; line-height: 13.5533332824707px;">ClientContext</span><span style="background: white; font-family: Consolas; font-size: 9.5pt; line-height: 13.5533332824707px;">("</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; line-height: 13.5533332824707px;">Site URL"</span><span style="background: white; font-family: Consolas; font-size: 9.5pt; line-height: 13.5533332824707px;">);</span><span style="font-family: Consolas; font-size: 9.5pt; line-height: 13.5533332824707px;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt;">NetworkCredential</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;"> Cred = </span><span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt;">new</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;"> </span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt;">NetworkCredential</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;">(</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt;">"UserName"</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;">, <span style="color: #a31515; font-size: 12.6666669845581px;">"Password"</span>, </span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt;">"Domain"</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;">);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; font-family: Consolas; font-size: 9.5pt;">clientContext.Credentials = Cred;<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; line-height: 13.5533332824707px;">Web</span><span style="background: white; font-family: Consolas; font-size: 9.5pt; line-height: 13.5533332824707px;"> web = clientContext.Web;</span><span style="font-family: Consolas; font-size: 9.5pt; line-height: 13.5533332824707px;"><o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; font-family: Consolas; font-size: 9.5pt;">clientContext.Load(web,
a => web.Title,<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; font-family: Consolas; font-size: 9.5pt;"> a =>
web.Description,<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; font-family: Consolas; font-size: 9.5pt; line-height: 107%;"> a => web.Created);clientContext.ExecuteQuery();</span><span style="font-family: Consolas; font-size: 9.5pt; line-height: 107%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">Console</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;">.WriteLine(</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">"Title:"</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;"> + web.Title);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">Console</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;">.WriteLine(</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">"Description:"</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;"> + web.Description);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">Console</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;">.WriteLine(</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-highlight: white;">"Created:"</span><span style="background: white; font-family: Consolas; font-size: 9.5pt;"> + web.Created);<o:p></o:p></span></div>
<br />
<div class="MsoNormal">
<span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-highlight: white;">onsole</span><span style="background: white; font-family: Consolas; font-size: 9.5pt; line-height: 107%;">.ReadLine();</span><span style="font-family: Consolas; font-size: 9.5pt; line-height: 107%;"><o:p></o:p></span></div>
<br /></div>
</div>
</div>
Divyesh Lappawalahttp://www.blogger.com/profile/13762323603816502055noreply@blogger.com0tag:blogger.com,1999:blog-7078821191825025499.post-81553258972709686942012-12-09T11:13:00.001-08:002012-12-09T11:15:53.293-08:00Visual Studio 2010 Keybinding <div dir="ltr" style="text-align: left;" trbidi="on">
<div>
<br /></div>
Get Visual Studio 2010 Key bindings from<span style="color: blue;"> <a href="http://www.microsoft.com/en-us/download/details.aspx?id=13189" rel="nofollow" target="_blank"><span style="color: blue;">Here</span></a></span><br />
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMRr37vOFaCnUSAXBRyi41a8BDn1ybdr0V1YwQKT5XU8qxpSWwxiXxYEhX8cGzGpeaig38pXFS_CGXE_TUl8sMkAsb7PHmOC-DT7XsakWXy0_rWvK8SqQNjGdca_dH0qzn_6XjmYpkqcE/s1600/VS+2010+Keybindings+Part+1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="451" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMRr37vOFaCnUSAXBRyi41a8BDn1ybdr0V1YwQKT5XU8qxpSWwxiXxYEhX8cGzGpeaig38pXFS_CGXE_TUl8sMkAsb7PHmOC-DT7XsakWXy0_rWvK8SqQNjGdca_dH0qzn_6XjmYpkqcE/s640/VS+2010+Keybindings+Part+1.png" width="640" /></a></div>
<div>
<br /></div>
</div>
Divyesh Lappawalahttp://www.blogger.com/profile/13762323603816502055noreply@blogger.com0tag:blogger.com,1999:blog-7078821191825025499.post-73013042657262598402012-12-09T08:53:00.002-08:002012-12-22T19:04:25.670-08:00Visual Studio 2010 / Visual Studio 2012 Extensions<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<b><u><span style="font-family: 'Trebuchet MS', sans-serif;">Visual Studio 2012</span></u></b></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<br /></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<span style="font-family: 'Trebuchet MS', sans-serif;">Productivity Power Tools</span></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<span style="color: blue; font-family: 'Trebuchet MS', sans-serif;"><a href="https://gsmail.fiserv.co.in/owa/redir.aspx?C=6a4d0eef74554d7fad0cebafea7cd312&URL=http%3a%2f%2fvisualstudiogallery.msdn.microsoft.com%2f3a96a4dc-ba9c-4589-92c5-640e07332afd" target="_blank">http://visualstudiogallery.msdn.microsoft.com/3a96a4dc-ba9c-4589-92c5-640e07332afd</a></span></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<span style="font-family: 'Trebuchet MS', sans-serif;"> </span></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<span style="font-family: 'Trebuchet MS', sans-serif;">Snippet Designer</span></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<span style="font-family: 'Trebuchet MS', sans-serif;"><a href="https://gsmail.fiserv.co.in/owa/redir.aspx?C=6a4d0eef74554d7fad0cebafea7cd312&URL=http%3a%2f%2fsnippetdesigner.codeplex.com%2f" target="_blank">http://snippetdesigner.codeplex.com/</a></span></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<br /></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<span style="font-family: 'Trebuchet MS', sans-serif;">Spell Checker</span></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<span style="color: blue; font-family: 'Trebuchet MS', sans-serif;"><a href="https://gsmail.fiserv.co.in/owa/redir.aspx?C=6a4d0eef74554d7fad0cebafea7cd312&URL=http%3a%2f%2fvisualstudiogallery.msdn.microsoft.com%2f7c8341f1-ebac-40c8-92c2-476db8d523ce" target="_blank">http://visualstudiogallery.msdn.microsoft.com/7c8341f1-ebac-40c8-92c2-476db8d523ce</a></span></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<br /></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<span style="font-family: 'Trebuchet MS', sans-serif;">Web Essentials 2012</span></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<span style="color: blue; font-family: 'Trebuchet MS', sans-serif;"><a href="https://gsmail.fiserv.co.in/owa/redir.aspx?C=6a4d0eef74554d7fad0cebafea7cd312&URL=http%3a%2f%2fvisualstudiogallery.msdn.microsoft.com%2f07d54d12-7133-4e15-becb-6f451ea3bea6%3fSRC%3dHome" target="_blank">http://visualstudiogallery.msdn.microsoft.com/07d54d12-7133-4e15-becb-6f451ea3bea6?SRC=Home</a></span></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<br /></div>
<div class="x_MsoNormal" style="font-family: Calibri, sans-serif; font-size: 11pt; margin: 0in 0in 0.0001pt;">
<br /></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<br /></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<br /></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<b><u><span style="font-family: 'Trebuchet MS', sans-serif;">Visual Studio 2010</span></u></b></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<br /></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<span style="font-family: 'Trebuchet MS', sans-serif;">PowerCommands for Visual Studio 2010</span></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<span style="color: blue; font-family: 'Trebuchet MS', sans-serif;"><a href="https://gsmail.fiserv.co.in/owa/redir.aspx?C=6a4d0eef74554d7fad0cebafea7cd312&URL=http%3a%2f%2fvisualstudiogallery.msdn.microsoft.com%2fe5f41ad9-4edc-4912-bca3-91147db95b99%2f" target="_blank">http://visualstudiogallery.msdn.microsoft.com/e5f41ad9-4edc-4912-bca3-91147db95b99/</a></span></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<br /></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<span style="font-family: 'Trebuchet MS', sans-serif;">Productivity Power Tools</span></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<span style="color: blue; font-family: 'Trebuchet MS', sans-serif;"><a href="https://gsmail.fiserv.co.in/owa/redir.aspx?C=6a4d0eef74554d7fad0cebafea7cd312&URL=http%3a%2f%2fvisualstudiogallery.msdn.microsoft.com%2fd0d33361-18e2-46c0-8ff2-4adea1e34fef%2f" target="_blank">http://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef/</a></span></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<br /></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<span style="font-family: 'Trebuchet MS', sans-serif;">Visual Studio Color Theme Editor</span></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<span style="color: blue; font-family: 'Trebuchet MS', sans-serif;"><a href="https://gsmail.fiserv.co.in/owa/redir.aspx?C=6a4d0eef74554d7fad0cebafea7cd312&URL=http%3a%2f%2fvisualstudiogallery.msdn.microsoft.com%2f20cd93a2-c435-4d00-a797-499f16402378%2f" target="_blank">http://visualstudiogallery.msdn.microsoft.com/20cd93a2-c435-4d00-a797-499f16402378/</a></span><br />
<br /></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<br /></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<span style="font-family: 'Trebuchet MS', sans-serif;">Web Essentials</span></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<a href="https://gsmail.fiserv.co.in/owa/redir.aspx?C=6a4d0eef74554d7fad0cebafea7cd312&URL=http%3a%2f%2fvisualstudiogallery.msdn.microsoft.com%2f6ed4c78f-a23e-49ad-b5fd-369af0c2107f" target="_blank"><span style="color: blue;">http://visualstudiogallery.msdn.microsoft.com/6ed4c78f-a23e-49ad-b5fd-369af0c2107f</span></a><span style="font-family: 'Trebuchet MS', sans-serif;"></span></div>
<div class="x_MsoPlainText" style="font-family: Consolas; font-size: 10.5pt; margin: 0in 0in 0.0001pt;">
<br /></div>
</div>
Divyesh Lappawalahttp://www.blogger.com/profile/13762323603816502055noreply@blogger.com0tag:blogger.com,1999:blog-7078821191825025499.post-89354048171725732572012-11-30T09:31:00.003-08:002012-12-09T11:14:49.819-08:00Link Server<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: center;">
<span style="color: blue; font-size: large;"><b>Link Server</b></span></div>
<div style="text-align: justify;">
<br /></div>
<br />
<div style="text-align: justify;">
<br />
<span style="color: #333333; font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 21px;"><br /></span></span>
<span style="color: #333333; font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 21px;">Linked Servers is a concept in SQL Server by which we can add other</span></span><br />
<span style="color: #333333; font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 21px;">SQL Server to a Group and query both the SQL Server dbs usig T-SQL Statements.</span></span><br />
<span style="color: #333333; font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 21px;">With a linked server, you can create very clean, easy to follow, SQL statements that allow remote data to be retrieved, </span></span><br />
<span style="color: #333333; font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 21px;">joined and combined with local data.</span></span><br />
<span style="color: #333333; font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 21px;">Stored Procedure sp_addlinkedserver, sp_addlinkedsrvlogin will be used add new Linked Server. </span></span><br />
</div>
<span id="ContentPlaceHolder1_lblDescription" style="background-color: white; color: #333333; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 21px;"><span itemprop="articleBody">
</span></span></div>
Divyesh Lappawalahttp://www.blogger.com/profile/13762323603816502055noreply@blogger.com0tag:blogger.com,1999:blog-7078821191825025499.post-60495325435840630992012-11-30T09:18:00.001-08:002012-12-09T11:14:49.817-08:00 Increase SQL Server stored procedure performance<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<span style="color: blue; font-size: large;"><br /></span>
<span style="color: blue; font-size: large;"><b> Increase SQL Server stored procedure performance</b></span><br />
<span style="color: blue; font-size: large;"><b><br /></b></span>
<br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">1. SET NOCOUNT ON</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">This help to stored procedures to stop the message indicating the number of rows affected by a Transact-SQL statement.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">This can reduce network traffic.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">2.Use return values</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">3.Don't write select * from [tablename]</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">write select [columnname1],[columnname2] from [tablename]</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">This helps to speed of the query.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">4.Don't use Prefix "Sp_" in your store procedure.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Becoz if you use "Sp" then SQL Server looks in the master database then your database.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">5.Use sp_executesql stored procedure instead of the EXECUTE statement.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">6.Avoid using temporary tables inside your stored procedure.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Becoz Using temporary tables inside stored procedure reduces the chance to reuse the execution plan.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">7.Avoid using DDL (Data Definition Language) statements inside your stored procedure.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Using DDL statements inside stored procedure reduces the chance to reuse the execution plan. </span><br />
<br />
<br />
<div>
<span style="color: blue; font-family: Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<br /></div>
</div>
Divyesh Lappawalahttp://www.blogger.com/profile/13762323603816502055noreply@blogger.com0tag:blogger.com,1999:blog-7078821191825025499.post-20578950345933417082012-08-17T23:24:00.000-07:002012-11-12T07:14:56.261-08:00LINQ Samples<div style="text-align: left" dir="ltr" trbidi="on"><a href="http://lh6.ggpht.com/-bgiRMxTClUE/UC_QhNySekI/AAAAAAAAAms/V2MOLaB3VHE/s1600-h/Linq%252520samples%25255B2%25255D.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Linq samples" border="0" alt="Linq samples" src="http://lh3.ggpht.com/-ubdA9-QPP7g/UC_QjFq7sgI/AAAAAAAAAm0/iR-qhveXu8A/Linq%252520samples_thumb.png?imgmax=800" width="183" height="56"></a> <br> <div style="text-align: left" dir="ltr" trbidi="on"></div> <div style="text-align: left" dir="ltr" trbidi="on">I will cover few examples which are using query operators. You can find list of query operators<span style="color: blue"> </span><a href="http://divyeshlappawalatech.blogspot.com/2012/08/linq-operators.html" target="_blank"><span style="color: blue">Here</span></a></div> <div style="text-align: left" dir="ltr" trbidi="on"><br>Refer Player class<br></div> <div style="text-align: left" dir="ltr" trbidi="on"><strong>Code</strong></div> <div style="text-align: left" dir="ltr" trbidi="on"> </div> <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"> <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> Player</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> FirstName { get; set; }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> LastName { get; set; }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Country { get; set; }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span>[] Scores { get; set; }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> ManOfTheSeries { get; set; }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> }</pre><!--CRLF--></div></div><br /><div style="text-align: left" dir="ltr" trbidi="on"><br> </div><br /><h3 style="text-align: left" dir="ltr" trbidi="on"><span style="color: #990000"><span style="color: blue"><strong>Type Filtering</strong></span></span></h3><br /><div style="text-align: left" dir="ltr" trbidi="on"><span style="font-family: trebuchet ms, sans-serif">Filtering based on the type.</span></div><br /><div style="text-align: left" dir="ltr" trbidi="on"></div><br /><div style="text-align: left" dir="ltr" trbidi="on"></div><br /><div style="text-align: left" dir="ltr" trbidi="on"><strong>Code</strong><br><br></div><br /><div style="text-align: left" dir="ltr" trbidi="on"><br /><div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><br /><div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: green">// FILTERING</span></pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Console.WriteLine(<span style="color: #006080">"List of batsmans who have scrored more than 50 runs in their First Match"</span>);</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: blue">foreach</span> (Player s <span style="color: blue">in</span> query)</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Console.WriteLine(s.FirstName + <span style="color: #006080">" "</span> + s.LastName + <span style="color: #006080">": "</span> + s.Scores[0]);</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: green">// Keep the console window open in debug mode.</span></pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: green">//TYPE FILTERING</span></pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: green">//GET the int data from the type which contains both string and int.</span></pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: blue">object</span>[] sampleObject = {1,2,<span style="color: #006080">"Three"</span>,4,5,<span style="color: #006080">"Six"</span>,<span style="color: #006080">"Seven"</span>,</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: blue">new</span> Player{</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> FirstName = <span style="color: #006080">"Virat"</span>,</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> LastName=<span style="color: #006080">"Kohli"</span>,</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Country=<span style="color: #006080">"India"</span>, </pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Scores = <span style="color: blue">new</span> <span style="color: blue">int</span>[] { 107, 119, 125, 114 }</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> } </pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> };</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: green">//Get the string </span></pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> var queryTypeFilteringString = sampleObject.OfType<<span style="color: blue">string</span>>();</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Console.WriteLine(<span style="color: #006080">""</span>);</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Console.WriteLine(<span style="color: #006080">"String Type"</span>);</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: blue">foreach</span> (var item <span style="color: blue">in</span> queryTypeFilteringString)</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> {</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Console.WriteLine(item);</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> }</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: green">//Get the Int</span></pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> var queryTypeFilteringInt = sampleObject.OfType<<span style="color: blue">int</span>>();</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Console.WriteLine(<span style="color: #006080">""</span>);</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Console.WriteLine(<span style="color: #006080">"Int Type"</span>);</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: blue">foreach</span> (var item <span style="color: blue">in</span> queryTypeFilteringInt)</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> {</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Console.WriteLine(item);</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> }</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: green">//Get Player</span></pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> var queryTypeFilteringPlayer = sampleObject.OfType<Player>();</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Console.WriteLine(<span style="color: #006080">""</span>);</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Console.WriteLine(<span style="color: #006080">"Player Type"</span>);</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: blue">foreach</span> (var item <span style="color: blue">in</span> queryTypeFilteringPlayer)</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> {</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Console.WriteLine(item.FirstName + <span style="color: #006080">" "</span>+ item.LastName);</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> }</pre></div></div><br><b>Output</b><br><br></div><br><br /><div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><br><br><br /><div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">String Type</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Three</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Six</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Seven</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Int Type</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">1</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">2</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">4</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">5</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Player Type</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Virat Kohli</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Press any key to exit.</pre></div></div><br><br><br><span style="color: blue; font-size: medium"><strong>Compound Form</strong></span><br><br>Below query will provide list of batsmans who have scored century (100) and above.<br><br><strong>Code</strong><br><br><br><br /><div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><br><br><br /><div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: green">//Compound</span></pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Console.WriteLine(<span style="color: #006080">"List of batsman who have scored Century (100) in their Matches"</span>);</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> var queryFilter = playerList</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> .SelectMany(</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> p=>p.Scores,</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> (p,s) => <span style="color: blue">new</span> {Player=p,Score=s})</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> .Where(p => p.Score > 100)</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> .OrderBy(p=>p.Player.FirstName)</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> .Select(a => a.Player.FirstName +<span style="color: #006080">" "</span>+a.Player.LastName + <span style="color: #006080">" "</span> + Convert.ToString(a.Score) );</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: blue">foreach</span> (<span style="color: blue">string</span> s <span style="color: blue">in</span> queryFilter)</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Console.WriteLine(s);</pre></div></div><br><b>Output</b><br><br><br><br /><div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><br><br><br /><div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Hashim Amla 165</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Mahela Jayawardene 185</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Ricky Ponting 180</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Ricky Ponting 142</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Sachin Tendulkar 200</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Sachin Tendulkar 190</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Sachin Tendulkar 170</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Sachin Tendulkar 150</pre><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Press any key to exit.</pre></div></div><br><br><span style="color: blue; font-size: medium"><strong>Sorting</strong></span><br>The OrderBy() and OrderByDescending() Methds returns IOrderedEnumerable<TSource>.<br><br><strong>Code</strong><br><br><br /><div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><br><br /><div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: green">//Indian Players with their scores, descending order by LastName</span></pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> var sortQuery = playerList</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> .SelectMany(p => p.Scores,</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> (p, s) => <span style="color: blue">new</span> { Player = p, Score = s })</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> .Where(p => p.Player.Country == <span style="color: #006080">"India"</span>)</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> .OrderByDescending(p => p.Player.LastName)</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> .Select(p => p);</pre><!--CRLF--></div></div><br><br><b>Output</b><br><br><br /><div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><br><br /><div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Sachin Tendulkar India 200</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Sachin Tendulkar India 190</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Sachin Tendulkar India 170</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Sachin Tendulkar India 150</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Virender Sehwag India 225</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Virender Sehwag India 170</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Virender Sehwag India 184</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Virender Sehwag India 102</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Press any key to exit.</pre><!--CRLF--></div></div><br><br><br><span style="color: blue; font-size: medium"><strong>Group By</strong></span><br><br><span style="color: blue; font-size: medium"><span style="color: black">To Group query results based on a key value ,the group clause can be used.</span></span><br><br><strong>Code</strong><br><br><br /><div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><br><br /><div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: green">// List of plyers count group by countries</span></pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> var countiresQry = from p <span style="color: blue">in</span> playerList</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> group p by p.Country into g</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> orderby g.Count() >= 2</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> select <span style="color: blue">new</span></pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> {</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Country = g.Key,</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Count = g.Count()</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> };</pre><!--CRLF--></div></div><br><br><br><b>Above Query with Extension methods</b><br><br><br /><div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><br><br /><div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">var countiresQry = playerList.</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> GroupBy(p=>p.Country).</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> OrderByDescending(g=>g.Count()).</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> ThenBy(g=>g.Key).</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Where(g=>g.Count()>1).</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Select(g=><span style="color: blue">new</span> {Country= g.Key, Count=g.Count()});</pre><!--CRLF--></div></div><br><br><br><b>Output</b><br><br><br /><div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><br><br /><div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">India 2</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Australia 2</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Sri Lanka 2</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">South Africa 2</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Press any key to exit.</pre><!--CRLF--></div></div><br><br><br><br><br><br><br><br><br><br><span style="color: blue; font-size: medium"><strong>Grouping With Nested Objects</strong></span><br><br><strong>Code</strong><br><br><br /><div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><br><br /><div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">var countiresQry = playerList.</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> GroupBy(p=>p.Country).</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> OrderByDescending(g=>g.Count()).</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> ThenBy(g=>g.Key).</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Where(g=>g.Count()>=2).</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Select(g=><span style="color: blue">new</span> </pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> {</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Country= g.Key, </pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Count=g.Count(),</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Players = g.OrderBy(r => r.LastName).Select(r => r.FirstName + <span style="color: #006080">" "</span> + r.LastName)</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> });</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: blue">foreach</span> (var item <span style="color: blue">in</span> countiresQry)</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> {</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Console.WriteLine(<span style="color: #006080">"Country:{0,-10} Plyer Count:{1}"</span>, item.Country, item.Count);</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: blue">foreach</span> (var name <span style="color: blue">in</span> item.Players)</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> {</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Console.Write(<span style="color: #006080">" Player Name:{0}\n "</span>,name);</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> }</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Console.WriteLine();</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> }</pre><!--CRLF--></div></div><br><strong>Output</strong><br><br><br /><div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><br><br /><div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Country:Australia Plyer Count:2</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Player Name:Adam Gilchrist</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Player Name:Ricky Ponting</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Country:India Plyer Count:2</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Player Name:Virender Sehwag</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Player Name:Sachin Tendulkar</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Country:South Africa Plyer Count:2</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Player Name:Hashim Amla</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Player Name:Graeme Smith</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Country:Sri Lanka Plyer Count:2</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Player Name:Mahela Jayawardene</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Player Name:Kumar Sangakara</pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><!--CRLF--><br><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Press any key to exit.</pre><!--CRLF--></div></div></div> Divyesh Lappawalahttp://www.blogger.com/profile/13762323603816502055noreply@blogger.com0tag:blogger.com,1999:blog-7078821191825025499.post-56220111449251013632012-08-17T20:11:00.000-07:002012-08-18T03:16:46.403-07:00LINQ Operators<div dir="ltr" style="text-align: left;" trbidi="on"><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/-kFln-xOJaOo/UC8J5zRZjEI/AAAAAAAAAmM/P0MZfFQEcjo/s1600/Linq+Operators.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-kFln-xOJaOo/UC8J5zRZjEI/AAAAAAAAAmM/P0MZfFQEcjo/s1600/Linq+Operators.png" /></a></div><br />LINQ Operators are key part of the Linq Query. operator uses Extension Methods to introduce these query methods to any type that implements the IEnumerable<T> interface.<br />Below table shows category wise Linq operator with description.<br /><br /><br /><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-wHtl0MYQBQU/UC8Ig_Y1NuI/AAAAAAAAAmE/18MzEEPsmCs/s1600/Linq+Operators.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-wHtl0MYQBQU/UC8Ig_Y1NuI/AAAAAAAAAmE/18MzEEPsmCs/s1600/Linq+Operators.png" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"></div><br /></div>Divyesh Lappawalahttp://www.blogger.com/profile/13762323603816502055noreply@blogger.com0tag:blogger.com,1999:blog-7078821191825025499.post-8375369235308436782012-08-17T11:28:00.000-07:002012-08-21T19:03:09.040-07:00LINQ To ADO.Net<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
</div>
<h2 style="text-align: left;">
</h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-AGVRYscFiMU/UC8KxXu4G9I/AAAAAAAAAmU/0PKYirBKg_8/s1600/Linq+to+ADO.Net1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-AGVRYscFiMU/UC8KxXu4G9I/AAAAAAAAAmU/0PKYirBKg_8/s1600/Linq+to+ADO.Net1.png" /></a></div>
<br />
<span style="font-family: Trebuchet MS, sans-serif;">There are three separate ADO.NET Language-Integrated Query (LINQ) technologies: LINQ to DataSet, LINQ to SQL, and LINQ to Entities. </span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br />LINQ to DataSet provides richer, optimized querying over the DataSet</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br />LINQ to SQL enables you to directly query SQL Server database schemas, and </span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br />LINQ to Entities allows you to query an Entity Data Model. </span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br /></span>
<br />
<div class="LW_CollapsibleArea_TitleDiv" style="margin-bottom: 19px; margin-top: 9px; overflow: hidden;">
<h3 style="text-align: left;">
</h3>
<h3 style="text-align: left;">
<span class="LW_CollapsibleArea_Title" style="background-color: white; display: inline-block; font-weight: bold; overflow: hidden; padding-left: 6px; word-break: break-all; word-wrap: break-word;"><span style="color: blue; font-family: Trebuchet MS, sans-serif; font-size: small;"> LINQ to DataSet</span></span></h3>
</div>
<div class="sectionblock" style="clear: both; padding-left: 15px;">
<div xmlns="http://www.w3.org/1999/xhtml">
<span style="font-family: Trebuchet MS, sans-serif;">The Dataset is one of the most widely used components in ADO.NET, and is a key element of the disconnected programming model that ADO.NET is built on. Despite this prominence, however, the </span><span style="font-family: 'Trebuchet MS', sans-serif;">Dataset</span><span style="font-family: 'Trebuchet MS', sans-serif;"> </span><span style="font-family: 'Trebuchet MS', sans-serif;"> has limited query capabilities. </span></div>
<div xmlns="http://www.w3.org/1999/xhtml">
<span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div style="margin-top: -6px;" xmlns="http://www.w3.org/1999/xhtml">
<span style="font-family: Trebuchet MS, sans-serif;">LINQ to DataSet enables you to build richer query capabilities into DataSet by using the same query functionality that is available for many other data sources</span></div>
<h3 style="font-size: 13.333333015441895px;">
</h3>
<h3>
</h3>
<h3 style="text-align: left;">
<span class="LW_CollapsibleArea_Title" style="background-color: white; display: inline-block; overflow: hidden; padding-left: 6px; word-break: break-all; word-wrap: break-word;"><span style="color: blue; font-family: Trebuchet MS, sans-serif; font-size: small;">LINQ to SQL</span></span></h3>
<div>
<span style="font-family: Trebuchet MS, sans-serif;"></span><span style="font-family: Trebuchet MS, sans-serif;">LINQ to SQL provides a run-time infrastructure for managing relational data as objects. In LINQ to SQL, the data model of a relational database is mapped to an object model expressed in the programming language of the developer. When you execute the application, LINQ to SQL translates language-integrated queries in the object model into SQL and sends them to the database for execution. When the database returns the results, LINQ to SQL translates them back into objects that you can manipulate.</span><br />
<span style="font-family: Trebuchet MS, sans-serif;">LINQ to SQL includes support for stored procedures and user-defined functions in the database, and for inheritance in the object model.</span><br />
<h3>
<span class="LW_CollapsibleArea_Title" style="background-color: white; display: inline-block; overflow: hidden; padding-left: 6px; word-break: break-all; word-wrap: break-word;"><span style="color: blue; font-family: Trebuchet MS, sans-serif; font-size: small;">LINQ to Entities</span></span></h3>
<br />
<span style="font-family: 'Trebuchet MS', sans-serif;">Through the Entity Data Model, relational data is exposed as objects in the .NET environment. This makes the object layer an ideal target for LINQ support, allowing developers to formulate queries against the database from the language used to build the business logic.</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div>
<span class="LW_CollapsibleArea_Title" style="background-color: white; display: inline-block; overflow: hidden; padding-left: 6px; word-break: break-all; word-wrap: break-word;"><span style="font-family: Trebuchet MS, sans-serif;"></span></span></div>
</div>
</div>
Divyesh Lappawalahttp://www.blogger.com/profile/13762323603816502055noreply@blogger.com0tag:blogger.com,1999:blog-7078821191825025499.post-31085647363716775442012-08-17T10:45:00.000-07:002012-08-18T09:24:53.223-07:00LINQ To Objects<div style="text-align: center; clear: both" dir="ltr" class="separator" trbidi="on"></div> <div style="text-align: left" dir="ltr" trbidi="on"> <div style="text-align: center; clear: both" class="separator"><a style="margin-left: 1em; margin-right: 1em" href="http://2.bp.blogspot.com/-EHNWw3HufDc/UC8BHBb2cdI/AAAAAAAAAlc/9ahMPNKVyCc/s1600/linq+to+objectsss.png" imageanchor="1"><img border="0" src="http://2.bp.blogspot.com/-EHNWw3HufDc/UC8BHBb2cdI/AAAAAAAAAlc/9ahMPNKVyCc/s1600/linq+to+objectsss.png"></a></div><span style="font-family: trebuchet ms, sans-serif"><br></span></div> <div style="text-align: left" dir="ltr" trbidi="on"> <div style="text-align: center; clear: both" class="separator"></div></div> <p style="text-align: left" dir="ltr" trbidi="on"><span style="font-family: trebuchet ms, sans-serif"></span> </p> <ul> <li><font size="4">LINQ to Objects refer to the use of LINQ queries with any IEnumerable or IEnumerable<T> collection.</font> <li><font size="4">LINQ to query any enumerable collections such as List<T>, Array, or Dictionary<TKey, TValue></font> <li><font size="4">LINQ to Objects represents a new approach to collections. In older way, you had to write complex foreach loops that specified how to retrieve data from a collection. </font> <li> <div style="text-align: left" trbidi="on"><font size="4"><span style="font-family: trebuchet ms, sans-serif"> </span><span style="font-family: trebuchet ms, sans-serif">LINQ queries offer three main advantages over traditional <span style="font-weight: 700" class="input">foreach</span> loops:</span></font></div></li></ul> <ol style="text-align: left"> <ol> <li style="list-style-image: none"><span style="font-family: trebuchet ms, sans-serif"><font size="4">They are more concise and readable, especially when filtering multiple conditions.</font></span> <li style="list-style-image: none"><span style="font-family: trebuchet ms, sans-serif"><font size="4">They provide powerful filtering, ordering, and grouping capabilities with a minimum of application code.</font></span> <li style="list-style-image: none"><span style="font-family: trebuchet ms, sans-serif"><font size="4">They can be ported to other data sources with little or no modification.</font></span></li></ol></ol> <blockquote> <p style="list-style-image: none"><font color="#0000ff" size="4"><strong>How to: Query an ArrayList with LINQ</strong></font></p></blockquote> <blockquote> <p><font size="4">LINQ to query non-generic IEnumerable collections such as ArrayList, you must explicitly declare the type of the range </font><font size="4">variable to reflect the specific type of the objects in the collection.</font></p> <p><font size="4">Here I have taken Cricket 's Player class to understand the Linq to Object. </font></p> <p><font size="4">Player contains single properties FirstName,LastName,Country and Multivalue Properties like Scores.List of batsman who have scrored more than 50 runs in their First Match</font></p></blockquote> <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"> <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> Player</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> FirstName { get; set; }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> LastName { get; set; }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Country { get; set; }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span>[] Scores { get; set; }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> ManOfTheSeries { get; set; }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: #0000ff">class</span> Program</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Main(<span style="color: #0000ff">string</span>[] args)</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> IList<Player> playerList = <span style="color: #0000ff">new</span> List<Player>()</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: #0000ff">new</span> Player</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> FirstName = <span style="color: #006080">"Sachin"</span>,</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> LastName = <span style="color: #006080">"Tendulkar"</span>,</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Country= <span style="color: #006080">"India"</span>,</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Scores = <span style="color: #0000ff">new</span> <span style="color: #0000ff">int</span>[] { 200, 190, 170,150 }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> },</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: #0000ff">new</span> Player</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> FirstName = <span style="color: #006080">"Ricky"</span>,</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> LastName = <span style="color: #006080">"Ponting"</span>,</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Country = <span style="color: #006080">"Australia"</span>,</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Scores = <span style="color: #0000ff">new</span> <span style="color: #0000ff">int</span>[] { 180, 84, 70, 142 }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> },</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: #0000ff">new</span> Player</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> FirstName = <span style="color: #006080">"Kumar"</span>,</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> LastName = <span style="color: #006080">"Sangakara"</span>,</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Country = <span style="color: #006080">"Sri Lanka"</span>,</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Scores = <span style="color: #0000ff">new</span> <span style="color: #0000ff">int</span>[] { 5, 80, 5, 39 }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> },</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: #0000ff">new</span> Player</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> FirstName = <span style="color: #006080">"Hashim"</span>,</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> LastName = <span style="color: #006080">"Amla"</span>,</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Country = <span style="color: #006080">"South Africa"</span>,</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Scores = <span style="color: #0000ff">new</span> <span style="color: #0000ff">int</span>[] { 88, 94, 65, 91 }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> },</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: #0000ff">new</span> Player</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> FirstName = <span style="color: #006080">"Mahela"</span>,</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> LastName = <span style="color: #006080">"Jayawardene"</span>,</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Country = <span style="color: #006080">"Sri Lanka"</span>,</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Scores = <span style="color: #0000ff">new</span> <span style="color: #0000ff">int</span>[] { 97, 89, 85, 82 }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> };</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> var query = from Player player <span style="color: #0000ff">in</span> playerList</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: #0000ff">where</span> player.Scores[0] >50</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> select player;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Console.WriteLine(<span style="color: #006080">"List of batsman who have scrored more than 50 runs in their First Match"</span>);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> <span style="color: #0000ff">foreach</span> (Player s <span style="color: #0000ff">in</span> query)</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Console.WriteLine(s.FirstName +<span style="color: #006080">" "</span> + s.LastName + <span style="color: #006080">": "</span> + s.Scores[0]);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Console.WriteLine(<span style="color: #006080">"Press any key to exit."</span>);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> Console.ReadKey();</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> } </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> }</pre><!--CRLF--></div></div><br /><p><font size="4"><strong>Output</strong><br>Sachin Tendulkar: 200<br>Ricky Ponting: 180<br>Hashim Amla: 88<br>Mahela Jayawardene: 97<br>Press any key to exit.</font><pre style="background-color: white; font-family: consolas; font-size: 16px"><span style="color: blue"><font size="4">To get same output with query operator,</font></span></pre><br /><p><font size="4">Replace above query part with below code.</font></p><br /><blockquote><br /><div class="csharpcode"><br /><div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><br /><div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Console.WriteLine(<span style="color: #006080">"FILTER- List of batsman who have scrored more than 50 runs in their First Match"</span>);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> var queryFilter = playerList</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> .Where(a => a.Scores[0] > 50)</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> .Select(a => a);</pre><!--CRLF--></div></div></div><br /><style type="text/css">.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }<br /></style><br /><br /><h3><font color="#0000ff" size="3"></font> <font color="#0000ff">Linq And String </font></h3><br /><p><a href="http://msdn.microsoft.com/en-us/library/bb397915.aspx"><font size="4">http://msdn.microsoft.com/en-us/library/bb397915.aspx</font></a><font size="4"> </font><br /><p><font size="4"><font color="#0000ff">LINQ and File Directories</font> </font><br /><p><a href="http://msdn.microsoft.com/en-us/library/bb397911.aspx"><font size="4">http://msdn.microsoft.com/en-us/library/bb397911.aspx</font></a><font size="4"> </font><br /><p><font color="#0000ff" size="4">LINQ and Reflection </font><br /><p><a href="http://msdn.microsoft.com/en-us/library/bb397929.aspx"><font size="4">http://msdn.microsoft.com/en-us/library/bb397929.aspx</font></a><font size="4"> </font><br /><p><font size="4"><font color="#0000ff">How to: Add Custom Methods for LINQ Queries</font> </font><br /><p><a href="http://msdn.microsoft.com/en-us/library/cc981895.aspx"><font size="4">http://msdn.microsoft.com/en-us/library/cc981895.aspx</font></a></p></blockquote> Divyesh Lappawalahttp://www.blogger.com/profile/13762323603816502055noreply@blogger.com0tag:blogger.com,1999:blog-7078821191825025499.post-67877810189271833062012-08-14T09:32:00.000-07:002012-08-18T03:16:46.408-07:00LINQ - .Net Framework<div dir="ltr" style="text-align: left;" trbidi="on"><div class="separator" style="clear: both; text-align: center;"></div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody><tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-JfBxCeAGvHA/UC77Am3TjAI/AAAAAAAAAk4/53RxXHz6u30/s1600/Linq+..NET+Frameworkk.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img alt="" border="0" height="118" src="http://2.bp.blogspot.com/-JfBxCeAGvHA/UC77Am3TjAI/AAAAAAAAAk4/53RxXHz6u30/s200/Linq+..NET+Frameworkk.png" title="Linq" width="200" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;"><br /></td></tr></tbody></table><h3 style="text-align: left;"><b><span style="color: blue;">Overview</span></b></h3><div><div class="MsoNormal"></div><div style="text-align: left;"></div><ul style="text-align: left;"><li><span style="font-family: Trebuchet MS, sans-serif;">Linq is uniform programming model which can interact with any kind of Data access like access,xml , SQL server, Oracle. </span></li></ul><ul style="text-align: left;"><li><span style="font-family: Trebuchet MS, sans-serif;">Linq enables you to query and manipulate the data independently of data sources and any transformation. It is generalize interface which can query to any data source.</span></li></ul><ul style="text-align: left;"><li><span style="font-family: Trebuchet MS, sans-serif;"><o:p> </o:p>Linq also provide type safety and any kind of data compile time checking.</span></li></ul><ul style="text-align: left;"><li><span style="font-family: Trebuchet MS, sans-serif;">It can serve as good entity for middle tier. So it is between UI and data access layer.</span></li></ul><ul style="text-align: left;"><li><span style="font-family: Trebuchet MS, sans-serif;">It provides declaratives syntax and enable developer to compile or provide what to do.</span></li></ul><ul style="text-align: left;"><li><span style="font-family: Trebuchet MS, sans-serif;">Hierarchical feature of LINQ allows you to easily see the relationship between tables, thereby making it easy to quickly compose queries that join multiple tables.</span></li></ul><ul style="text-align: left;"><li><span style="font-family: Trebuchet MS, sans-serif;">If you know Linq to object, it is easier to learn linq to SQL and Linq to XML</span></li></ul><ul style="text-align: left;"><li><span style="font-family: Trebuchet MS, sans-serif;">The composable feature of LINQ also makes it easy to break complex problems into a series of short, comprehensible queries that are easy to debug</span></li></ul><ul style="text-align: left;"><li><span style="font-family: Trebuchet MS, sans-serif;">Because LINQ is composable, you can easily join multiple data sources in a single query, or in a series of related queries</span></li></ul><ul style="text-align: left;"><li><span style="font-family: Trebuchet MS, sans-serif;">The compiler and provider translate declarative code into the code that is actually executed. As a rule, LINQ knows more than the average developer about how to write highly optimized, efficient code.</span></li></ul><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/-i5QYGOgEc-k/UC524sLY2RI/AAAAAAAAAj0/JlW_M8jjynw/s1600/linq+img.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="280" src="http://4.bp.blogspot.com/-i5QYGOgEc-k/UC524sLY2RI/AAAAAAAAAj0/JlW_M8jjynw/s320/linq+img.png" width="320" /></a></div><div><br /></div><h3 style="text-align: left;"><span style="background-color: white; color: blue;">Entity Framework - .Net Framework 4.5</span></h3><div><span style="background-color: white; color: blue;"><br /></span></div><h4 style="text-align: left;"><strong style="background-color: white; border: 0px; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; line-height: 14.999999046325684px; margin: 0px; outline: 0px; padding: 0px;"><span style="color: blue;">Auto-Compiled LINQ Queries</span></strong></h4><div><strong style="background-color: white; border: 0px; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 12.499999046325684px; line-height: 14.999999046325684px; margin: 0px; outline: 0px; padding: 0px;"><span style="color: blue;"><br /></span></strong></div><div><div><span style="color: blue; font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="line-height: 15px;"><b><br /></b></span></span></div><div><span style="font-family: Segoe UI, Lucida Grande, Verdana, Arial, Helvetica, sans-serif;"><span style="line-height: 15px;">When you write a LINQ to Entities query before .Net framework 4.5, the Entity Framework walks over the expression tree generated by the C#/Visual Basic compiler and translates (or compiles) that into SQL</span></span></div></div><div style="text-align: left;"><span style="background-color: white; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 12.499999046325684px; line-height: 14.999999046325684px;"><br /></span><span style="background-color: white; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 12.499999046325684px; line-height: 14.999999046325684px;"><br /></span></div><div style="text-align: left;"><span style="background-color: white; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 12.499999046325684px; line-height: 14.999999046325684px;"><br /></span></div><div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-lSuvzPX6fvc/UC56PG5JYbI/AAAAAAAAAkI/V7x1GRck6EE/s1600/Auto+Compiled+Query.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="97" src="http://2.bp.blogspot.com/-lSuvzPX6fvc/UC56PG5JYbI/AAAAAAAAAkI/V7x1GRck6EE/s640/Auto+Compiled+Query.png" width="640" /></a></div><div style="text-align: left;"><span style="background-color: white; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 12.499999046325684px; line-height: 14.999999046325684px;"><br /></span></div><div class="separator" style="clear: both; text-align: center;"></div><div><br /></div><div style="text-align: left;"><br /><span style="color: #333333; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 15px;">Compiling the expression tree into SQL involves some overhead, though, particularly for more complex queries. In previous versions of the Entity Framework, if you wanted to avoid having to pay this performance penalty every time a LINQ query was executed, you had to use the CompiledQuery class.</span></span><br /><span style="color: #333333; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 15px;"><br /></span></span><span style="color: #333333; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 15px;">This new version of the Entity Framework 4.5 supports a new feature called Auto-Compiled LINQ Queries. Now every LINQ to Entities query that you execute automatically gets compiled and placed in the Entity Framework query plan cache. Each additional time you run the query, the Entity Framework will find it in its query cache and won’t have to go through the whole compilation process again. </span></span><br /><br /><div><br /></div></div><div style="text-align: left;"><span style="background-color: white; color: #333333; font-family: Trebuchet MS, sans-serif; font-size: 12.499999046325684px; line-height: 14.999999046325684px;"><br /></span></div></div></div>Divyesh Lappawalahttp://www.blogger.com/profile/13762323603816502055noreply@blogger.com0tag:blogger.com,1999:blog-7078821191825025499.post-1829816463020255002012-08-14T09:30:00.000-07:002012-08-20T18:31:09.941-07:00.NET Framework 4.5<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
</div>
<h2>
<strong>Overview of .NET Framework</strong></h2>
<div dir="ltr" style="text-align: left;" trbidi="on">
</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
The .NET Framework is an integral Windows component that supports building and running the next generation of applications and XML Web services.The .NET Framework is designed to fulfill the following objectives:</div>
<ul>
<li> To provide a consistent object-oriented programming environment whether object code is stored and executed locally, executed locally but Internet-distributed, or executed remotely.<br />
</li>
<li> To provide a code-execution environment that minimizes software deployment and versioning conflicts.<br />
</li>
<li> To provide a code-execution environment that promotes safe execution of code, including code created by an unknown or semi-trusted third party.<br />
</li>
<li> To provide a code-execution environment that eliminates the performance problems of scripted or interpreted environments.<br />
</li>
<li> To make the developer experience consistent across widely varying types of applications, such as Windows-based applications and Web-based applications.<br />
</li>
<li> To build all communication on industry standards to ensure that code based on the .NET Framework can integrate with any other code.</li>
</ul>
<br />
The .NET Framework has two main components: the common language runtime and the .NET Framework class library.<br />
<div dir="ltr" style="text-align: left;" trbidi="on">
<a href="http://lh3.ggpht.com/-qrORMLkeq-I/UDLgMPj82TI/AAAAAAAAAnE/xrGPMl6lvhs/s1600-h/.NET%252520Framework%252520Main%25255B6%25255D.gif"><img alt=".NET Framework Main" border="0" height="224" src="http://lh5.ggpht.com/-wQZjjYThgEQ/UDLgNZFNzxI/AAAAAAAAAnM/V6qFkkrLl8Y/.NET%252520Framework%252520Main_thumb%25255B4%25255D.gif?imgmax=800" style="border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;" title=".NET Framework Main" width="244" /></a> </div>
<div dir="ltr" style="text-align: left;" trbidi="on">
</div>
<h3>
<strong>Common Language Runtime</strong></h3>
<br />
The common language runtime manages memory, thread execution, code execution, code safety verification, compilation, and other system services. These features are intrinsic to the managed code that runs on the common language runtime. <br />
With regards to security, managed components are awarded varying degrees of trust, depending on a number of factors that include their origin (such as the Internet, enterprise network, or local computer). This means that a managed component might or might not be able to perform file-access operations, registry-access operations, or other sensitive functions, even if it is being used in the same active application. <br />
The runtime enforces code access security. For example, users can trust that an executable embedded in a Web page can play an animation on screen or sing a song, but cannot access their personal data, file system, or network. The security features of the runtime thus enable legitimate Internet-deployed software to be exceptionally feature rich. <br />
The runtime also enforces code robustness by implementing a strict type-and-code-verification infrastructure called the common type system (CTS). The CTS ensures that all managed code is self-describing. The various Microsoft and third-party language compilers generate managed code that conforms to the CTS. This means that managed code can consume other managed types and instances, while strictly enforcing type fidelity and type safety. <br />
In addition, the managed environment of the runtime eliminates many common software issues. For example, the runtime automatically handles object layout and manages references to objects, releasing them when they are no longer being used. This automatic memory management resolves the two most common application errors, memory leaks and invalid memory references. <br />
The runtime also accelerates developer productivity. For example, programmers can write applications in their development language of choice, yet take full advantage of the runtime, the class library, and components written in other languages by other developers. Any compiler vendor who chooses to target the runtime can do so. Language compilers that target the .NET Framework make the features of the .NET Framework available to existing code written in that language, greatly easing the migration process for existing applications. <br />
While the runtime is designed for the software of the future, it also supports software of today and yesterday. Interoperability between managed and unmanaged code enables developers to continue to use necessary COM components and DLLs. <br />
The runtime is designed to enhance performance. Although the common language runtime provides many standard runtime services, managed code is never interpreted. A feature called just-in-time (JIT) compiling enables all managed code to run in the native machine language of the system on which it is executing. Meanwhile, the memory manager removes the possibilities of fragmented memory and increases memory locality-of-reference to further increase performance. <br />
the runtime can be hosted by high-performance, server-side applications, such as Microsoft® SQL Server™ and Internet Information Services (IIS). This infrastructure enables you to use managed code to write your business logic, while still enjoying the superior performance of the industry's best enterprise servers that support runtime hosting. <br />
<br />
<h3>
<strong>.NET Framework Class Library</strong></h3>
The .NET Framework class library is a collection of reusable types that tightly integrate with the common language runtime. The class library is object oriented, providing types from which your own managed code can derive functionality. This not only makes the .NET Framework types easy to use, but also reduces the time associated with learning new features of the .NET Framework.<br />
The .NET Framework types enable you to accomplish a range of common programming tasks, including tasks such as string management, data collection, database connectivity, and file access. In addition to these common tasks, the class library includes types that support a variety of specialized development scenarios.<br />
Console applications. See Building Console Applications in the .NET Framework. <br />
Windows GUI applications (Windows Forms). See Windows Forms. <br />
Windows Presentation Foundation (WPF) applications. See Introduction to WPF. <br />
ASP.NET applications. See Developing Web Applications with ASP.NET. <br />
Windows services. See Introduction to Windows Service Applications. <br />
Service-oriented applications using Windows Communication Foundation (WCF). See Developing Service-Oriented Applications with WCF. <br />
Workflow-enabled applications using Windows Workflow Foundation (WF). See Building Workflows in the .NET Framework. <br />
<div dir="ltr" style="text-align: left;" trbidi="on">
</div>
<h2>
<strong>New Features in .NET 4.5</strong></h2>
<div dir="ltr" style="text-align: left;" trbidi="on">
</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<a href="http://lh6.ggpht.com/-q-7QssHPLr8/UDLgPMEvYYI/AAAAAAAAAnU/Lw7y2FdxS7w/s1600-h/.NET%252520Framework%252520New%25255B5%25255D.png"><img alt=".NET Framework New" border="0" height="151" src="http://lh4.ggpht.com/-a8R3H-B_k_s/UDLgQqH7lWI/AAAAAAAAAnc/CeQJHMhOzvA/.NET%252520Framework%252520New_thumb%25255B1%25255D.png?imgmax=800" style="border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;" title=".NET Framework New" width="244" /></a> </div>
<div dir="ltr" style="text-align: left;" trbidi="on">
</div>
<h3>
<strong>Core New Features and Improvements</strong></h3>
<ul> The following features and improvements were added to the common language runtime and to .NET Framework classes: <br />
<li> Ability to reduce system restarts by detecting and closing .NET Framework 4 applications during deployment. See <a href="http://msdn.microsoft.com/en-us/library/hh527997">Reducing System Restarts During .NET Framework 4.5 Installations</a>.<br />
</li>
<li> Support for arrays that are larger than 2 gigabytes (GB) on 64-bit platforms. This feature can be enabled in the application configuration file. See the<a href="http://msdn.microsoft.com/en-us/library/hh285054"><gcAllowVeryLargeObjects> element</a>, which also lists other restrictions on object size and array size.<br />
</li>
<li> Better performance through background garbage collection for servers. When you use server garbage collection in the .NET Framework 4.5, background garbage collection is automatically enabled.<br />
</li>
<li> Background just-in-time (JIT) compilation, which is optionally available on multi-core processors to improve application performance. See <a href="http://msdn.microsoft.com/en-us/library/system.runtime.profileoptimization">ProfileOptimization</a>.<br />
</li>
<li> Ability to limit how long the regular expression engine will attempt to resolve a regular expression before it times out. See the <a href="http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.matchtimeout">RegexMatchTimeout</a> property.<br />
</li>
<li> Ability to define the default culture for an application domain. See the <a href="http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo">CultureInfo</a> class.<br />
</li>
<li> Console support for Unicode (UTF-16) encoding. See the <a href="http://msdn.microsoft.com/en-us/library/system.console">Console</a> class.<br />
</li>
<li> Support for versioning of cultural string ordering and comparison data. See the <a href="http://msdn.microsoft.com/en-us/library/system.globalization.sortversion">SortVersion</a> class.<br />
</li>
<li> Better performance when retrieving resources. See <a href="http://msdn.microsoft.com/en-us/library/sb6a8618">Packaging and Deploying Resources in Desktop Apps</a>.<br />
</li>
<li> Zip compression improvements to reduce the size of a compressed file. See the <a href="http://msdn.microsoft.com/en-us/library/system.io.compression">System.IO.Compression</a> namespace.<br />
</li>
<li> Ability to customize a reflection context to override default reflection behavior through the <a href="http://msdn.microsoft.com/en-us/library/system.reflection.context.customreflectioncontext">CustomReflectionContext</a> class.<br />
</li>
<li> Support for the 2008 version of the Internationalized Domain Names in Applications (IDNA) standard when the <a href="http://msdn.microsoft.com/en-us/library/system.globalization.idnmapping">IdnMapping</a> class is used on Windows 8.<br />
</li>
<li> Delegation of string comparison to the operating system, which implements Unicode 6.0, when the .NET Framework is used on Windows 8. When running on other platforms, the .NET Framework includes its own string comparison data, which implements Unicode 5.x. See the <a href="http://msdn.microsoft.com/en-us/library/system.string">String</a> class and the Remarks section of the<a href="http://msdn.microsoft.com/en-us/library/system.globalization.sortversion">SortVersion</a> class.<br />
</li>
<li> Ability to compute the hash codes for strings on a per application domain basis. See <a href="http://msdn.microsoft.com/en-us/library/jj152924"><UseRandomizedStringHashAlgorithm> Element</a>.</li>
</ul>
<br />
<br />
<h3>
<strong>Portable Class Libraries </strong></h3>
The Portable Class Library project in Visual Studio 2012 enables you to write and build managed assemblies that work on multiple .NET Framework platforms. Using a Portable Class Library project, you choose the platforms (such as Windows Phone and .NET for Windows Store apps) to target. The available types and members in your project are automatically restricted to the common types and members across these platforms.<br />
For more information, see <a href="http://msdn.microsoft.com/en-us/library/gg597391">Portable Class Library Overview</a>. <br />
<h3>
<strong></strong> </h3>
<h3>
<strong>Managed Extensibility Framework (MEF) </strong></h3>
The Managed Extensibility Framework (MEF) provides the following new features: <br />
<ul>
<li> Support for generic types.<br />
</li>
<li> Convention-based programming model that enables you to create parts based on naming conventions rather than attributes.<br />
</li>
<li> Multiple scopes.<br />
</li>
<li> A subset of MEF that you can use when you create Metro style apps. This subset is available as a <a href="http://go.microsoft.com/fwlink/?LinkId=256238">downloadable package</a> from the NuGet Gallery. To install the package, open your project in Visual Studio 2012, choose Manage NuGet Packages from the Project menu, and search online for the Microsoft.Compositionpackage.</li>
</ul>
For more information, see <a href="http://msdn.microsoft.com/en-us/library/dd460648">Managed Extensibility Framework Overview</a>. <br />
<br />
<h3>
<strong>Tools</strong></h3>
Resource File Generator (Resgen.exe) enables you to create a .resw file for use in Windows Metro style apps from a .resources file embedded in a .NET Framework assembly. For more information, see <a href="http://msdn.microsoft.com/en-us/library/ccec7sz1">Resgen.exe (Resource File Generator)</a>.<br />
<br />
<h3>
<strong>Asynchronous File Operations </strong></h3>
In the .NET Framework 4.5, new asynchronous features were added to the C# and Visual Basic languages. These features add a task-based model for performing asynchronous operations. To use this new model, use the asynchronous methods in the I/O classes. See <a href="http://msdn.microsoft.com/en-us/library/kztecsys">Asynchronous File I/O</a>.<br />
<br />
<h3>
<strong>Parallel Computing </strong></h3>
The .NET Framework 4.5 provides several new features and improvements for parallel computing. These include improved performance, increased control, improved support for asynchronous programming, a new dataflow library, and improved support for parallel debugging and performance analysis. See the entry <a href="http://go.microsoft.com/fwlink/?LinkId=235061">What’s New for Parallelism in .NET 4.5</a> in the Parallel Programming with .NET blog.<br />
<br />
<h3>
<strong>Web </strong></h3>
ASP.NET 4.5 includes the following new features:<br />
<ul>
<li> Support for new HTML5 form types.<br />
</li>
<li> Support for model binders in Web Forms. These let you bind data controls directly to data-access methods, and automatically convert user input to and from .NET Framework data types.<br />
</li>
<li> Support for unobtrusive JavaScript in client-side validation scripts.<br />
</li>
<li> Improved handling of client script through bundling and minification for improved page performance.<br />
</li>
<li> Integrated encoding routines from the AntiXSS library (previously an external library) to protect from cross-site scripting attacks.<br />
</li>
<li> Support for WebSockets protocol.<br />
</li>
<li> Support for reading and writing HTTP requests and responses asynchronously.<br />
</li>
<li> Support for asynchronous modules and handlers.<br />
</li>
<li> Support for content distribution network (CDN) fallback in the ScriptManager control.</li>
</ul>
See <a href="http://msdn.microsoft.com/en-us/library/hh420390">ASP.NET 4.5 and Visual Studio 2012</a>. <br />
<h3>
<strong>WPF </strong></h3>
In the .NET Framework 4.5, Windows Presentation Foundation (WPF) contains changes and improvements in the following areas: <br />
<ul>
<li> The new <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.ribbon.ribbon">Ribbon</a> control, which enables you to implement a ribbon user interface that hosts a Quick Access Toolbar, Application Menu, and tabs.<br />
</li>
<li> The new <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifydataerrorinfo">INotifyDataErrorInfo</a> interface, which supports synchronous and asynchronous data validation.<br />
</li>
<li> New features for the <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.virtualizingpanel">VirtualizingPanel</a> and <a href="http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher">Dispatcher</a> classes.<br />
</li>
<li> Improved performance when displaying large sets of grouped data, and by accessing collections on non-UI threads.<br />
</li>
<li> Data binding to static properties, data binding to custom types that implement the <a href="http://msdn.microsoft.com/en-us/library/system.reflection.icustomtypeprovider">ICustomTypeProvider</a> interface, and retrieval of data binding information from a binding expression.<br />
</li>
<li> Repositioning of data as the values change (live shaping).<br />
</li>
<li> Ability to check whether the data context for an item container is disconnected.<br />
</li>
<li> Ability to set the amount of time that should elapse between property changes and data source updates.<br />
</li>
<li> Improved support for implementing weak event patterns. Also, events can now accept markup extensions.</li>
</ul>
For more information, see <a href="http://msdn.microsoft.com/en-us/library/bb613588">What's New in WPF Version 4.5 RC</a>. <br />
<br />
<strong>WCF </strong><br />
In the .NET Framework 4.5, the following features have been added to make it simpler to write and maintain Windows Communication Foundation (WCF) applications: <br />
<ul>
<li> Simplification of generated configuration files.<br />
</li>
<li> Support for contract-first development.<br />
</li>
<li> Ability to configure ASP.NET compatibility mode more easily.<br />
</li>
<li> Changes in default transport property values to reduce the likelihood that you will have to set them.<br />
</li>
<li> Updates to the <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmldictionaryreaderquotas">XmlDictionaryReaderQuotas</a> class to reduce the likelihood that you will have to manually configure quotas for XML dictionary readers.<br />
</li>
<li> Validation of WCF configuration files by Visual Studio as part of the build process, so you can detect configuration errors before you run your application.<br />
</li>
<li> New asynchronous streaming support.<br />
</li>
<li> New HTTPS protocol mapping to make it easier to expose an endpoint over HTTPS with Internet Information Services (IIS).<br />
</li>
<li> Ability to generate metadata in a single WSDL document by appending ?singleWSDL to the service URL.<br />
</li>
<li> Websockets support to enable true bidirectional communication over ports 80 and 443 with performance characteristics similar to the TCP transport.<br />
</li>
<li> Support for configuring services in code.<br />
</li>
<li> XML Editor tooltips.<br />
</li>
<li> <a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.channelfactory">ChannelFactory</a> caching support.<br />
</li>
<li> Binary encoder compression support.<br />
</li>
<li> Support for a UDP transport that enables developers to write services that use "fire and forget" messaging. A client sends a message to a service and expects no response from the service.<br />
</li>
<li> Ability to support multiple authentication modes on a single WCF endpoint when using the HTTP transport and transport security.<br />
</li>
<li> Support for WCF services that use internationalized domain names (IDNs).</li>
</ul>
For more information, see <a href="http://go.microsoft.com/fwlink/?LinkId=228173">What's New in Windows Communication Foundation</a>. <br />
<h3>
<strong></strong> </h3>
<h3>
<strong>WF</strong></h3>
Several new features have been added to Windows Workflow Foundation (WF) in the .NET Framework 4.5. These new features include: <br />
<ul>
<li> State machine workflows, which were first introduced as part of the .NET Framework 4.0.1 (<a href="http://go.microsoft.com/fwlink/?LinkID=215092">.NET Framework 4 Platform Update 1</a>). This update included several new classes and activities that enabled developers to create state machine workflows. These classes and activities were updated for the .NET Framework 4.5 to include: <br />
<ul>
<li> The ability to set breakpoints on states.<br />
</li>
<li> The ability to copy and paste transitions in the workflow designer.<br />
</li>
<li> Designer support for shared trigger transition creation.<br />
</li>
<li> Activities for creating state machine workflows, including: <a href="http://msdn.microsoft.com/en-us/library/system.activities.statements.statemachine">StateMachine</a>, <a href="http://msdn.microsoft.com/en-us/library/system.activities.statements.state">State</a>, and <a href="http://msdn.microsoft.com/en-us/library/system.activities.statements.transition">Transition</a>.</li>
</ul>
</li>
<li> Enhanced Workflow Designer features such as the following: <br />
<ul>
<li> Enhanced workflow search capabilities in Visual Studio, including Quick Find and Find in Files.<br />
</li>
<li> Ability to automatically create a Sequence activity when a second child activity is added to a container activity, and to include both activities in the Sequence activity.<br />
</li>
<li> Panning support, which enables the visible portion of a workflow to be changed without using the scroll bars.<br />
</li>
<li> A new Document Outline view that shows the components of a workflow in a tree-style outline view and lets you select a component in the Document Outline view.<br />
</li>
<li> Ability to add annotations to activities.<br />
</li>
<li> Ability to define and consume activity delegates by using the workflow designer.<br />
</li>
<li> Auto-connect and auto-insert for activities and transitions in state machine and flowchart workflows.</li>
</ul>
</li>
<li> Storage of the view state information for a workflow in a single element in the XAML file, so you can easily locate and edit the view state information.<br />
</li>
<li> A NoPersistScope container activity to prevent child activities from persisting.<br />
</li>
<li> Support for C# expressions: <br />
<ul>
<li> Workflow projects that use Visual Basic will use Visual Basic expressions, and C# workflow projects will use C# expressions.<br />
</li>
<li> C# workflow projects that were created in Visual Studio 2010 and that have Visual Basic expressions are compatible with C# workflow projects that use C# expressions.</li>
</ul>
</li>
<li> Versioning enhancements: <br />
<ul>
<li> The new <a href="http://msdn.microsoft.com/en-us/library/system.activities.workflowidentity">WorkflowIdentity</a> class, which provides a mapping between a persisted workflow instance and its workflow definition.<br />
</li>
<li> Side-by-side execution of multiple workflow versions in the same host, including <a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.activities.workflowservicehost">WorkflowServiceHost</a>.<br />
</li>
<li> In Dynamic Update, the ability to modify the definition of a persisted workflow instance.</li>
</ul>
</li>
<li> Contract-first workflow service development, which provides support for automatically generating activities to match an existing service contract.</li>
<br />
<br />
<br />
</ul>
For more information, see <a href="http://go.microsoft.com/fwlink/?LinkId=228176">What's New in Windows Workflow Foundation</a>. <br />
<div dir="ltr" style="text-align: left;" trbidi="on">
</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<h3 style="text-align: left;">
Relative Link</h3>
<a href="http://blogs.msdn.com/b/dotnet/archive/2011/09/21/introducing-net-framework-4-5.aspx">http://blogs.msdn.com/b/dotnet/archive/2011/09/21/introducing-net-framework-4-5.aspx</a></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
</div>
<h3>
<strong>Reference Links</strong></h3>
<div dir="ltr" style="text-align: left;" trbidi="on">
<a href="http://msdn.microsoft.com/">http://msdn.microsoft.com/</a></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<br />
</div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
</div>
Divyesh Lappawalahttp://www.blogger.com/profile/13762323603816502055noreply@blogger.com0