DbExpressionBuilder.CastTo(DbExpression, TypeUsage) Method

Definition

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

C#
public static System.Data.Common.CommandTrees.DbCastExpression CastTo(this System.Data.Common.CommandTrees.DbExpression argument, System.Data.Metadata.Edm.TypeUsage toType);

Parameters

argument
DbExpression

The argument to which the cast should be applied.

toType
TypeUsage

Type metadata that specifies the type to cast to.

Returns

A new DbCastExpression with the specified argument and target type.

Exceptions

argument or toType is null.

The specified cast is not valid.

Applies to

Product Versions
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1