LINQ in Action

Author: Fabrice Marguerie, Steve Eichert, Jim Wooley
4.0
All Stack Overflow 10
This Month Stack Overflow 1

LINQ in Action

4.0

Review Date:

Comments

by anonymous   2017-08-20

Though you may be "using" System.Linq in your project, you are not using the so-called "Linq-to-XML" classes. Which make things about 5 times easier, even you're not using LINQ on them! Use the System.Linq.XML namesspace, to have access to these new xml classes (XDocument, XElement, etc.)

    XDocument XDoc = XDocument.Load("ThePath") 
    String Field1 = (String)XDoc.Root.Element("Data").Element("Field1")
by anonymous   2017-08-20

ADO.Net may be a pretty broad topic. Here are some books that I've had success with:

by Koistya Navin   2017-08-20

I personally preffer LINQ to SQL and ADO.NET Entity Framework. Microsoft guys also use those technologies in their latest projects (take a look at KOBE project for example). Thus, Microsoft recommends those two as well.

Though.. sometimes I use Data Access Application block from Enterprise Library and manual DAL coding when I need maximum control over it's functionality and implementation.

Other alternatives are: NHibernate, SubSonic, different ORM solutions like LLBLGen Pro.


Great books on this subject:


Related tools:

  • LINQPad is also a great way to learn LINQ: it comes preloaded with 200 examples from the book, C# 3.0 in a Nutshell. There's no better way to experience the coolness of LINQ and functional programming.
by anonymous   2017-08-20

Well, to start with List<T> does have the FindAll and ConvertAll methods - but the more idiomatic, modern approach is to use LINQ:

// Find all the people older than 30
var query1 = list.Where(person => person.Age > 30);

// Find each person's name
var query2 = list.Select(person => person.Name);

You'll need a using directive in your file to make this work:

using System.Linq;

Note that these don't use strings to express predicates and projects - they use delegates, usually created from lambda expressions as above.

If lambda expressions and LINQ are new to you, I would suggest you get a book covering LINQ first, such as LINQ in Action, Pro LINQ, C# 4 in a Nutshell or my own C# in Depth. You certainly can learn LINQ just from web tutorials, but I think it's such an important technology, it's worth taking the time to learn it thoroughly.