Export (0) Print
Expand All

ListAttribute class

Specifies that a property of a DataContext object represents a Microsoft SharePoint Foundation list.

System.Object
  System.Attribute
    Microsoft.SharePoint.Linq.ListAttribute

Namespace:  Microsoft.SharePoint.Linq
Assembly:  Microsoft.SharePoint.Linq (in Microsoft.SharePoint.Linq.dll)

[AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = false)]
public sealed class ListAttribute : Attribute

For example, the following shows a simplified declaration of a DataContext-derived class that has several properties that represent lists:


public partial class TeamSiteDataContext : DataContext 
{
    // ctors omitted for readability.
    
    [List(Name="Projects")]
    public EntityList<Item> Projects 
    {
        get {
            return this.GetList<Item>("Projects");
        }
    }
    
    [List(Name="Managers")]
    public EntityList<Item> Managers 
    {
        get {
            return this.GetList<Item>("Managers");
        }
    }
    
    [List(Name="Team Members")]
    public EntityList<Item> TeamMembers 
    {
        get {
            return this.GetList<Item>("Team Members");
        }
    }
}

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2015 Microsoft