Export (0) Print
Expand All

ColumnAttribute Class

Specifies that the property is mapped to a field (column) in a Microsoft SharePoint Foundation list.

System.Object
  System.Attribute
    Microsoft.SharePoint.Linq.DataAttribute
      Microsoft.SharePoint.Linq.ColumnAttribute

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

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

Every property that is mapped to a field must have this attribute..

The following is an example of a content type class with a property that is decorated with the ColumnAttribute:


[ContentType(Name="Item", Id="0x01", List="Team Members")]
[DataContract()]
public partial class TeamMembersItem : Item {
    
    private System.Nullable<double> _memberID;
        
    public TeamMembersItem() {
        this.Initialize();
    }

    [Column(Name="MemberID", Storage="_memberID", Required=true, FieldType="Number")]
    [DataMember()]
    public System.Nullable<double> MemberID {
        get {
            return this._memberID;
        }
        set {
            if ((this._memberID != value)) {
                this.OnPropertyChanging("MemberID", this._memberID);
                this._memberID = value;
                this.OnPropertyChanged("MemberID");
            }
        }
    }

    // Other members omitted for readability.
}


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:
© 2014 Microsoft