3 ms·
As contextfree says, Linq2Sql is an ORM and Linq is really a set of a few technologies (expression trees, lambdas, anonymous types) originally created FOR Linq2
by troygoode 16y ago
As contextfree says, Linq2Sql is an ORM and Linq is really a set of a few technologies (expression trees, lambdas, anonymous types) originally created FOR Linq2Sql but now used all over the place.
An example of non-L2S use of Linq to sort an array of objects:
//array of dogs
var dogs = new[]{
new Dog{Name = "Bowser", Age = 1, Gender = "M"},
new Dog{Name = "Yoshi", Age = 2, Gender = "M"},
new Dog{Name = "Molly", Age = 2, Gender = "F"}
};
//get all male dogs ordered from oldest to youngest
var dogs2 = dogs.Where(dog=> dog.Gender == "M").OrderByDescending(dog=> dog.Age);
No database access involved.