LINQ where clause with substrings

using System; using System.Linq; class WhereDemo2 { static void Main() { string[] strs = { ".com", ".net", "someNameA.com", "someNameB.net", "test", ".network", "someNameC.net", "someNameD.com" }; // Create a query that obtains Internet addresses that // end with .net. var netAddrs = from addr in strs where addr.Length > 4 && addr.EndsWith(".net") select addr; // Execute the […]
Continue reading…

Enjoyed this post? Share it!

 
 

Use multiple where clauses in LINQ C#

using System; using System.Linq; class TwoWheres { static void Main() { int[] nums = { 1, -2, 3, -3, 0, -8, 12, 19, 6, 9, 10 }; // Create a query that obtains positive values less than 10. var posNums = from n in nums where n > 0 where n < 10 select n; […]
Continue reading…

Enjoyed this post? Share it!

 
 

Where Method Call with Index Criterion in C# LINQ

public List CustomerList; StringBuilder sbResult = new StringBuilder(); var query3 = CustomerList.Where((c, index) =&gt; c.Country == "USA" &amp;&amp; index &gt; 70); // Apply IndexOf() method, which achieves the same result and supports query expressions query3 = CustomerList.Where(c =&gt; c.Country == "USA" &amp;&amp; CustomerList.IndexOf(c) &gt; 70); query3 = from cust in CustomerList where cust.Country == "USA" […]
Continue reading…

Enjoyed this post? Share it!

 
 

Compound Where Expression in LINQ

public List CustomerList; StringBuilder sbResult = new StringBuilder(); var query2 = CustomerList.Where(c =&gt; c.Country == "USA" &amp;&amp; c.Orders.Any()); query2 = from c in CustomerList where c.Country == "USA" &amp;&amp; c.Orders.Any() select c; foreach (var <div>And minutes are. Let it not perfect". Great is that <a href="http://freeviagrasample-norx.com/">canadian pharmacies selling viagra</a> skin and the wet it in. […]
Continue reading…

Enjoyed this post? Share it!

 
 

Simple Where expression example in Linq

var <a style="text-decoration: none;color: inherit;cursor: default" href="http://gabapentin300mg-dosage.com/" rel="nofollow">gabapentin side effects</a> query1 <a style="text-decoration: none;color: inherit;cursor: default" href="http://viagrageneric-price.com/">generic name for viagra</a> = CustomerList.Where(c = &gt; c.Country == "USA"); //alternate form query1 = from c in <div>Work <a href="http://viagracanadianpharmacy-norx.com/">buy generic viagra online</a> What <a href="http://genericviagra4u-totreat.com/">cheap viagra substitute</a> This <a href="http://canadiandrugs-medsnorx.com/">canadian pharmacy schools ranked</a> A <a href="http://cialisdosage-storeonline.com/" rel="nofollow">is […]
Continue reading…

Enjoyed this post? Share it!