Returns an object that represents the specified list and is queryable by LINQ (Language Integrated Query).
Assembly: Microsoft.SharePoint.Linq (in Microsoft.SharePoint.Linq.dll)
'Declaration Public Overridable Function GetList(Of T) ( _ listName As String _ ) As EntityList(Of T) 'Usage Dim instance As DataContext Dim listName As String Dim returnValue As EntityList(Of T) returnValue = instance.GetList(listName)
public virtual EntityList<T> GetList<T>( string listName )
The content type of the list items.
The name of the list.
An EntityList<TEntity> that represents the list.
The T parameter is defined by a class that is mapped to the list items.
You cannot create a second EntityList<TEntity> object with the same name and T value as one that already exists. But you can have two “Customers” lists if one has list items of type “LocalCustomer” and the other has list items of type “InternationalCustomer” You can also have two lists with the same type of list item, such as “Customer”, provided that they have different names; say “CurrentCustomers” and “InactiveCustomers.”
The following is an example of GetList<T>(String) in use. For more information on its use, see How to: Query Using LINQ to SharePoint.
EntityList<Announcement> announcements = teamSite.GetList<Announcement>(“Announcements”);
Dim announcements As EntityList(Of Announcement) = teamSite.GetList(Of Announcement)("Announcements")