ListAttribute 类

指定的DataContext对象属性表示Microsoft SharePoint Foundation列表。

继承层次结构

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

命名空间:  Microsoft.SharePoint.Linq
程序集:  Microsoft.SharePoint.Linq(位于 Microsoft.SharePoint.Linq.dll 中)

语法

声明
<AttributeUsageAttribute(AttributeTargets.Property Or AttributeTargets.Field, AllowMultiple := False)> _
Public NotInheritable Class ListAttribute _
    Inherits Attribute
用法
Dim instance As ListAttribute
[AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = false)]
public sealed class ListAttribute : Attribute

示例

例如,下面的示例演示一个简化的DataContext声明的派生类具有多个属性表示列表:

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");
        }
    }
}

线程安全性

该类型的任何公共 静态 (已共享 在 Visual Basic 中) 成员都是线程安全的。不保证任何实例成员都是线程安全的。

另请参阅

引用

ListAttribute 成员

Microsoft.SharePoint.Linq 命名空间