ResultTypeAttribute.Type 属性

定义

为具有不同结果类型的函数获取有效的或预期的类型映射。Gets the valid or expected type mapping for a function having various result types.

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

属性值

Type

结果的类型 (Type)。The type of result (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

注解

此属性适用于返回各种结果类型的函数。This attribute applies to functions returning various result types. 它用于声明从函数返回的可能的结果类型。It is used to declare the possible result types returned from the function. 对于继承类型,只需指定继承层次结构的根类型。For inheritance types, only the root type of the inheritance hierarchy needs to be specified.

适用于