DefaultStatusCodeAttribute 類別

定義

指定與 ActionResult 相關聯的預設狀態碼。

public ref class DefaultStatusCodeAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false, Inherited=true)]
public sealed class DefaultStatusCodeAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)]
public sealed class DefaultStatusCodeAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false, Inherited=true)>]
type DefaultStatusCodeAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)>]
type DefaultStatusCodeAttribute = class
    inherit Attribute
Public NotInheritable Class DefaultStatusCodeAttribute
Inherits Attribute
繼承
DefaultStatusCodeAttribute
屬性

備註

此屬性僅供參考,而且沒有任何執行時間效果。 在類別上套用 屬性, ActionResult 表示該類別所代表的 預設會使用特定的狀態碼。 將 屬性套用至方法, ActionResult 表示 方法傳回的 預設會使用該狀態碼。 在我們需要指定方法修改預設在其邏輯中使用的狀態碼,或指定 API 分析器中取用的狀態碼 ActionResult 時,稍後會很有説明。

建構函式

DefaultStatusCodeAttribute(Int32)

初始化 DefaultStatusCodeAttribute 的新執行個體。

屬性

StatusCode

取得預設狀態碼。

適用於