using Microsoft.SharePoint.Client;
using System.Linq;
public List GetListByName(string siteUrl, string listName)
{
using(ClientContext _context = new ClientContext(siteUrl))
{
//in case of login user has access to site
_context.Credentials = System.Net.CredentialCache.DefaultCredentials;
//if you want to provide the credentials
// _context.Credentials = new System.Net.NetworkCredential(userName, password, domain);
Web web = _context.Web;
var list = _context.LoadQuery(_context.Web.Lists.Where(l => l.Title == listName));
_context.ExecuteQuery();
return list.FirstOrDefault();
}
}This code snippet is for how to Get SharePoint List by List Title using LINQ.
