EntityCollection<TEntity>.Count Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets the number of objects that are contained in the collection.

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

public int Count { get; }

Property Value

Type: System.Int32

The number of elements that are contained in the EntityCollection<TEntity>.

The Count property gets the number of entities currently in the local collection and does not reflect the size of the collection in the data source. A count of zero does not necessarily indicate that the related collection is empty. To determine the collection size in the data source, call the M:System.Data.Objects.DataClasses.EntityCollection`1.Load method or include the related object in the query path. For more information, see Loading Related Objects.

.NET Framework
Available since 3.5
Return to top