Geeks With Blogs
Berthin Ramampiandra Linq
How to perform Cross Join with Linq
Cross join consists to perform a Cartesian product of two sets or sequences. The following example shows a simple Cartesian product of the sets A and B: A (a1, a2) B (b1, b2) => C (a1 b1, a1 b2, a2 b1, a2, b2 ) is the Cartesian product's result. Linq to Sql allows using Cross join operations. Cross join is not equijoin, means that no predicate expression of equality in the Join clause of the query. To define a cross join query, you can use multiple from clauses. Note that there's no explicit operator ......

Posted On Friday, May 25, 2012 10:44 PM

Linq: How to use First() and FirstOrDefault() methods properly
First() and FirstOrDefault() are two extension methods of the Enumerable class. Extension method is a static method that we can call from an instance object which implement IEnumerable interface. Lets make an analysis of the following simple example. 1:int[] number = { 1, 5, 6, 8, 20, 15, 34, 67, 98, 12, 23 }; 2:var num = number.Where(n => n > 100).First(); 3:Console.WriteLine("First Number greater than 100: {0}", num); By definition, First() method return the first element of a sequence. So ......

Posted On Friday, July 22, 2011 9:30 PM

Copyright © berthin | Powered by: GeeksWithBlogs.net | Join free