DbSet.Cast<TEntity> Method

[This page is specific to the Entity Framework version 6. The latest version is available as the 'Entity Framework' NuGet package. For more information about Entity Framework, see msdn.com/data/ef.]

Returns the equivalent generic DbSet<TEntity> object.

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

public DbSet<TEntity> Cast<TEntity>()
where TEntity : class

Type Parameters


The type of entity for which the set was created.

Return Value

Type: System.Data.Entity.DbSet<TEntity>
The generic set object.