Compartilhar via


LookupList<T>.Assign Method

Replaces the entities currently associated with this LookupList<T> with the specified collection.

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

Syntax

'Declaration
Public Sub Assign ( _
    items As IEnumerable(Of T) _
)
'Usage
Dim instance As LookupList
Dim items As IEnumerable(Of T)

instance.Assign(items)
public void Assign(
    IEnumerable<T> items
)

Parameters

Remarks

Typically, this method is called by the set accessor of a property that wraps a LookupList<T> field. It calls the OnChanging handler before it writes a new set of values to the LookupList<T> field. It calls OnChanged just after it writes a new set of values to the field.

Examples

The following code shows Assign(IEnumerable<T>) in use:

ContentType(Name="Item", Id="0x01", List="Team Members")]
[DataContract()]
public partial class TeamMembersItem : Item {

    [DataMember()]
    private LookupList<String> _assignedProjectsTitles;

    [Column(Name="AssignedProjects", Storage="_assignedProjectsTitles", FieldType="Lookup", IsLookupValue=true, LookupDisplayColumn="Title")]
    public IList<String> AssignedProjectsTitles {
        get {
           return this._assignedProjectsTitles;
        }
        set {
            this._assignedProjectsTitles.Assign(value);
        }
    }
}

See Also

Reference

LookupList<T> Class

LookupList<T> Members

Microsoft.SharePoint.Linq Namespace