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
- expression
Type: Microsoft.Data.Edm.Expressions.IEdmExpression
The expression to assert the type of.
- type
Type: Microsoft.Data.Edm.IEdmTypeReference
The type to assert the expression as.
- context
Type: Microsoft.Data.Edm.IEdmType
The context paths are to be evaluated in.
- matchExactly
Type: System.Boolean
A value indicating whether the expression must match the asserted type exactly, or simply be compatible.
- discoveredErrors
Type: System.Collections.Generic.IEnumerable<EdmError>%
Errors produced if the expression does not match the specified type.
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.