LINQ to SharePoint is that it can query SharePoint data with a fully-typed approach. LINQ to SharePoint targets to SharePoint data.
SharePoint uses SPMetal.exe to generate entities class. SPMetal presents in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN directory.
To use LINQ to SharePoint we need to give reference to Microsoft.SharePoint.Linq.
SPMetal takes a lot of arguments like
/Web:{URL} , /useremoteapi , /code:{file name} , /language:{language name like csharp or vb} , /namespace etc.
By default SPMetal.exe generates code to the console. But if you want to generate code to a file then
SPMETAL.EXE /web:{URL} /code:codefilename.cs
Here is an example to add an item to a SharePoint Foundation list using LINQ. (Followed from MSDN)
DataContext data = new DataContext(SPContext.Current.Web.Url);
EntityList<Customer> Customers = data.GetList<Customer>("Customers");
//Customers is the custon list name.
Customer newCustomer = new Customer() { CustomerId=2, City=”enjoysharepoint” };
Customers.InsertOnSubmit(newCustomer);
data.SubmitChanges();
LINQ to SharePoint 2010 will have all the support of IntelliSense.