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)

Syntax

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

returnValue = expression.TryAssertType(type, _
    discoveredErrors)
public static bool TryAssertType(
    this IEdmExpression expression,
    IEdmTypeReference type,
    out IEnumerable<EdmError> discoveredErrors
)
[ExtensionAttribute]
public:
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

Parameters

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 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