@@ -130,7 +130,7 @@ Object-Relational Mapping (ORM) which allows you:
130130
131131- Work with data-store in object-oriented way
132132- Query any supported data source
133- - Potantially change data source
133+ - Potentially change data source
134134- Has own change tracking system which can be extended
135135- Business specifications can be reused throughout your project
136136- Currently prefered data access in wich Microsoft invests the most
@@ -453,8 +453,8 @@ A group join produces a sequence of object arrays based on properties equivalenc
453453```cs
454454
455455from s in Students
456- join c in Courses on s .StudentID equals a .StudentID into t
457- select { StudentName = s .Name , Courses = t }
456+ join c in Courses on s .StudentID equals s .StudentID into t
457+ select new { StudentName = s .Name , Courses = t }
458458
459459```
460460
@@ -474,7 +474,7 @@ If there are no columns matching in the right table, it returns NULL values.
474474from s in Students
475475join a in Addresses on s .AddressID equals a .AddressID into t
476476from st in t .DefaultIfEmpty ()
477- select { AddressID = (int ?)st .AddressID , st .City , StudentName = s .Name }
477+ select new { AddressID = (int ?)st .AddressID , st .City , StudentName = s .Name }
478478
479479```
480480
@@ -490,7 +490,7 @@ Cross join returns records or rows that are multiplication of record number from
490490
491491from s in Students
492492from a in Addresses
493- select { a .City , s .Name }
493+ select new { a .City , s .Name }
494494
495495```
496496
@@ -527,8 +527,8 @@ var count = nums.Count(); // 9
527527
528528``` cs
529529
530- int [] nums = {500 ,100 ,50 ,20 ,10 ,5 ,2 ,1 ,1000 };
531- var count = nums .Sum (); // 1688
530+ int [] nums = {300 ,100 ,50 ,20 ,10 ,5 ,2 ,1 ,1000 };
531+ var count = nums .Sum (); // 1488
532532
533533```
534534
@@ -574,8 +574,8 @@ Performs custom aggregation:
574574
575575``` cs
576576
577- int [] nums = {500 ,100 ,50 ,20 ,10 ,5 ,2 ,1 ,1000 };
578- var sum = nums .Aggregate (0 , (total , n ) => total + n ); // 1688
577+ int [] nums = {300 ,100 ,50 ,20 ,10 ,5 ,2 ,1 ,1000 };
578+ var sum = nums .Aggregate (0 , (total , n ) => total + n ); // 1488
579579
580580```
581581
@@ -644,7 +644,7 @@ IEnumerable<string> strings = values.OfType<string>();
644644object [] values = new object [] {" 1" , " 2" , " 3" , " AAA" , 5 };
645645IEnumerable < string > strings = values .Cast <string >();
646646// an exception will be thrown
647- // because the last element is not string
647+ // because the last element is not string
648648
649649```
650650
@@ -670,4 +670,6 @@ var flatten = values.SelectMany(s => s);
670670
671671Additional resources:
672672
673- - https://weblogs.asp.net/dixin/linq-via-csharp
673+ - https://weblogs.asp.net/dixin/linq-via-csharp
674+ - https://codeblog.jonskeet.uk/category/edulinq
675+ - http://linqsamples.com
0 commit comments