共用方式為


ExpressionTypeChecker.TryCast 方法

定義

多載

TryCast(IEdmExpression, IEdmTypeReference, IEnumerable<EdmError>)

判斷運算式的型別是否與提供的型別相容

TryCast(IEdmExpression, IEdmTypeReference, IEdmType, Boolean, IEnumerable<EdmError>)

判斷運算式的型別是否與提供的型別相容

TryCast(IEdmExpression, IEdmTypeReference, IEnumerable<EdmError>)

判斷運算式的型別是否與提供的型別相容

public static bool TryCast (this Microsoft.OData.Edm.IEdmExpression expression, Microsoft.OData.Edm.IEdmTypeReference type, out System.Collections.Generic.IEnumerable<Microsoft.OData.Edm.Validation.EdmError> discoveredErrors);
static member TryCast : Microsoft.OData.Edm.IEdmExpression * Microsoft.OData.Edm.IEdmTypeReference * seq -> bool
<Extension()>
Public Function TryCast (expression As IEdmExpression, type As IEdmTypeReference, ByRef discoveredErrors As IEnumerable(Of EdmError)) As Boolean

參數

expression
IEdmExpression

要判斷提示其型別的運算式。

type
IEdmTypeReference

提供的型別,要判斷提示運算式做為此型別。

discoveredErrors
IEnumerable<EdmError>

如果運算式與指定之型別不相符時所產生的錯誤。

傳回

值,指出運算式對給定型別而言是否為有效。

備註

如果運算式有關聯的型別,此函式將會檢查其是否符合預期的型別並停止進行其他查閱。 如果運算式宣告型別,必須驗證型別對運算式有效。 如果運算式沒有宣告型別,此方法將會嘗試以判斷提示的型別來檢查運算式本身的有效性。

適用於

TryCast(IEdmExpression, IEdmTypeReference, IEdmType, Boolean, IEnumerable<EdmError>)

判斷運算式的型別是否與提供的型別相容

public static bool TryCast (this Microsoft.OData.Edm.IEdmExpression expression, Microsoft.OData.Edm.IEdmTypeReference type, Microsoft.OData.Edm.IEdmType context, bool matchExactly, out System.Collections.Generic.IEnumerable<Microsoft.OData.Edm.Validation.EdmError> discoveredErrors);
static member TryCast : Microsoft.OData.Edm.IEdmExpression * Microsoft.OData.Edm.IEdmTypeReference * Microsoft.OData.Edm.IEdmType * bool * seq -> bool
<Extension()>
Public Function TryCast (expression As IEdmExpression, type As IEdmTypeReference, context As IEdmType, matchExactly As Boolean, ByRef discoveredErrors As IEnumerable(Of EdmError)) As Boolean

參數

expression
IEdmExpression

要判斷提示其型別的運算式。

type
IEdmTypeReference

提供的型別,要判斷提示運算式做為此型別。

context
IEdmType

要進行評估的內容路徑。

matchExactly
Boolean

值,指出運算式是否必須完全符合判斷提示的型別或僅為相容。

discoveredErrors
IEnumerable<EdmError>

如果運算式與指定之型別不相符時所產生的錯誤。

傳回

值,指出運算式對給定型別而言是否為有效。

備註

如果運算式有關聯的型別,此函式將會檢查其是否符合預期的型別並停止進行其他查閱。 如果運算式宣告型別,必須驗證型別對運算式有效。 如果運算式沒有宣告型別,此方法將會嘗試以判斷提示的型別來檢查運算式本身的有效性。

適用於