Removes an object from the collection and marks the relationship for deletion.
Assembly: System.Data.Entity (in System.Data.Entity.dll)
The method also deletes the relationship between the source object and the object being removed from the collection. If the relationship has a referential integrity constraint, calling the method on a dependent object marks both the relationship and the dependent object for deletion. This occurs because the constraint indicates that the dependent object cannot exist without a relationship to the parent. For more information, see Referential Constraints (Entity Framework).
returns false when the specified object is not in the collection.
This example is based on the Adventure Works Sales Model. To run the code in this example, you must have already added the AdventureWorks Sales Model to your project and configured your project to use the Entity Framework. To do this, complete the procedures in How to: Manually Configure an Entity Framework Project and How to: Manually Define an E*ntity Data Model (Entity Framework).
This example uses the method to remove one of the entities from the collection and then calls the Contains method to determine whether the object was removed from the collection.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.