EntityCollection<TEntity>.Remove Method (TEntity)

 

Removes an object from the collection and marks the relationship for deletion.

Namespace:   System.Data.Entity.Core.Objects.DataClasses
Assembly:  EntityFramework (in EntityFramework.dll)

public bool Remove(
	TEntity item
)

Parameters

item
Type: TEntity

The object to remove from the collection.

Return Value

Type: System.Boolean

true if item was successfully removed; otherwise, false.

Exception Condition
ArgumentNullException

entity object is null.

InvalidOperationException

The entity object is not attached to the same object context.-or-The entity object does not have a valid relationship manager.