ExpressionTypeChecker.TryAssertType Method (IEdmExpression, IEdmTypeReference, IEdmType, Boolean, 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)

Syntax

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

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

Parameters

  • matchExactly
    Type: System.Boolean
    A value indicating whether the expression must match the asserted type exactly, or simply be compatible.

Return Value

Type: System.Boolean
A value indicating whether the expression is valid for the given type or not.

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 https://msdn.microsoft.com/en-us/library/bb384936(v=vs.113) or https://msdn.microsoft.com/en-us/library/bb383977(v=vs.113).

Remarks

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

Reference

ExpressionTypeChecker Class

TryAssertType Overload

Microsoft.Data.Edm.Validation Namespace