ResultTypeAttribute.Type 屬性

定義

針對具有各種結果型別的函式,取得有效或預期的型別對應。

public:
 property Type ^ Type { Type ^ get(); };
public Type Type { get; }
member this.Type : Type
Public ReadOnly Property Type As Type

屬性值

結果的型別 (Type)。

範例

[Function(Name="dbo.VariableResultShapes")]
[ResultType(typeof(VariableResultShapesResult1))]
[ResultType(typeof(VariableResultShapesResult2))]
public IMultipleResults VariableResultShapes([Parameter(DbType="Int")] System.Nullable<int> shape)
{
    IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), shape);
    return ((IMultipleResults)(result.ReturnValue));
}
<FunctionAttribute(Name:="dbo.VariableResultShapes"), _
ResultType(GetType(VariableResultShapesResult1)), _
ResultType(GetType(VariableResultShapesResult2))> _
Public Function VariableResultShapes(<Parameter(DbType:="Int")> ByVal shape As System.Nullable(Of Integer)) As IMultipleResults
    Dim result As IExecuteResult = Me.ExecuteMethodCall(Me, CType(MethodInfo.GetCurrentMethod, MethodInfo), shape)
    Return CType(result.ReturnValue, IMultipleResults)
End Function

備註

此屬性適用於傳回各種結果類型的函式。 它用來宣告從函式傳回的可能結果型別。 針對繼承類型,只需要指定繼承階層的根類型。

適用於