ExpressionTypeChecker.TryAssertType Method (IEdmExpression, IEdmTypeReference, IEnumerable<EdmError>%)

Determines if the type of an expression is compatible with the provided type.

Namespace:  Microsoft.Data.Edm.Validation
Assembly:  Microsoft.Data.Edm (in Microsoft.Data.Edm.dll)


<ExtensionAttribute> _
Public Shared Function TryAssertType ( _
    expression As IEdmExpression, _
    type As IEdmTypeReference, _
    <OutAttribute> ByRef discoveredErrors As IEnumerable(Of EdmError) _
) As Boolean
Dim expression As IEdmExpression 
Dim type As IEdmTypeReference 
Dim discoveredErrors As IEnumerable(Of EdmError)
Dim returnValue As Boolean 

returnValue = expression.TryAssertType(type, _
public static bool TryAssertType(
    this IEdmExpression expression,
    IEdmTypeReference type,
    out IEnumerable<EdmError> discoveredErrors
static bool TryAssertType(
    IEdmExpression^ expression, 
    IEdmTypeReference^ type, 
    [OutAttribute] IEnumerable<EdmError^>^% discoveredErrors
static member TryAssertType : 
        expression:IEdmExpression * 
        type:IEdmTypeReference * 
        discoveredErrors:IEnumerable<EdmError> byref -> bool
public static function TryAssertType(
    expression : IEdmExpression, 
    type : IEdmTypeReference, 
    discoveredErrors : IEnumerable<EdmError>
) : boolean


Return Value

Type: System.Boolean
true if the type of an expression is compatible with the provided type; otherwise, false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEdmExpression. When you use instance method syntax to call this method, omit the first parameter. For more information, see or


If the expression has an associated type, this function will check that it matches the expected type and stop looking further. If an expression claims a type, it must be validated that the type is valid for the expression. If the expression does not claim a type this method will attempt to check the validity of the expression itself with the asserted type.

See Also


ExpressionTypeChecker Class

TryAssertType Overload

Microsoft.Data.Edm.Validation Namespace