Friday, September 10th, 2010

Concat operator example in C# LINQ

var Query12 = CustomerList.Where(c = > c.Country == “USA”)
                    .Concat(CustomerList.Where(c = > c.Country == “Canada”)
                    .Concat(CustomerList.Where(c = > c.Country == “Mexico”)));
 
Query12 = (from c in CustomerList
                 where c.Country == “USA”
                 select c)
                .Concat((from c in CustomerList
                 where c.Country == “Canada”
                 select c)
                 .Concat((from c in CustomerList
                 where c.Country == “Mexico”
                 select c)));
 
foreach (var c in Query12)
           sbResult.Append(String.Format(“CustID = {0}, Name = {1}, Country = {2}\r\n”,
           c.CustomerID, c.CompanyName, c.Country));
Share Article/Example:
  • DotNetKicks
  • DZone
  • StumbleUpon
  • Print
  • Add to favorites
  • Digg
  • del.icio.us
  • Twitter
  • Facebook
  • LinkedIn
  • Posterous
  • Slashdot

Tags:

Readers Comments (0)




Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.


Latest Additions

Popular User Submitted Links

1


Hosted & Optimized JS Libraries – Cached Commons

1


Multi-File Uploader & Resizer – Agile Uploader

1


Open source online notebook-to-do-list manager

1


3 tier app design in silverlight using azure & RIA services

1


Polymaps – A JS Library For Image & Vector-Tiled Maps

eXTReMe Tracker