Share via


EntityCollection<TEntity>.Add Method

[WCF RIA Services Version 1 Service Pack 2 is compatible with either .NET framework 4 or .NET Framework 4.5, and with either Silverlight 4 or Silverlight 5.]

Adds the specified entity to this collection.

Namespace:  System.ServiceModel.DomainServices.Client
Assembly:  System.ServiceModel.DomainServices.Client (in System.ServiceModel.DomainServices.Client.dll)

Syntax

'Declaration
Public Sub Add ( _
    entity As TEntity _
)
'Usage
Dim instance As EntityCollection
Dim entity As TEntity

instance.Add(entity)
public void Add(
    TEntity entity
)
public:
void Add(
    TEntity entity
)
member Add : 
        entity:'TEntity -> unit 
public function Add(
    entity : TEntity
)

Parameters

  • entity
    Type: TEntity
    The entity to add.

Remarks

If the entity is unattached, it will be added to its EntitySet automatically.

Examples

if ((value != null))
{
    value.Employee1.Add(this);
    this.Employee1.EntityAdded += new EventHandler<EntityCollectionChangedEventArgs<Employee>>(Employee1_EntityAdded);

}

See Also

Reference

EntityCollection<TEntity> Class

System.ServiceModel.DomainServices.Client Namespace