DbExpressionBuilder.CastTo Method (DbExpression, TypeUsage)

.NET Framework (current version)
 
System_CAPS_noteNote

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

Creates a new DbCastExpression that applies a cast operation to a polymorphic argument.

Namespace:   System.Data.Common.CommandTrees.ExpressionBuilder
Assembly:  System.Data.Entity (in System.Data.Entity.dll)

public static DbCastExpression CastTo(
	this DbExpression argument,
	TypeUsage toType
)

Parameters

argument
Type: System.Data.Common.CommandTrees.DbExpression

The argument to which the cast should be applied.

toType
Type: System.Data.Metadata.Edm.TypeUsage

Type metadata that specifies the type to cast to.

Return Value

Type: System.Data.Common.CommandTrees.DbCastExpression

A new DbCastExpression with the specified argument and target type.

Exception Condition
ArgumentNullException

Argument or toType is null.

ArgumentException

The specified cast is not valid.

.NET Framework
Available since 4.5
Return to top
Show: