Share via


DefaultStatusCodeAttribute Class

Definition

Specifies the default status code associated with an ActionResult.

public ref class DefaultStatusCodeAttribute sealed : 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)]
public sealed class DefaultStatusCodeAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)>]
type DefaultStatusCodeAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false, Inherited=true)>]
type DefaultStatusCodeAttribute = class
    inherit Attribute
Public NotInheritable Class DefaultStatusCodeAttribute
Inherits Attribute
Inheritance
DefaultStatusCodeAttribute
Attributes

Remarks

This attribute is informational only and does not have any runtime effects. Applying the attribute on a class indicates that the ActionResult represented by that class uses a particular status code by default. Applying the attribute to a method indicates that the ActionResult returned by the method uses that status code by default. The later is helpful in scenarios where we need to specify that a method modifies the status code that an ActionResult uses by default in its logic or for specifying the status code for consumption in the API analyzers.

Constructors

Name Description
DefaultStatusCodeAttribute(Int32)

Initializes a new instance of DefaultStatusCodeAttribute.

Properties

Name Description
StatusCode

Gets the default status code.

Applies to