Dela via


ActionResultStatusCodeAttribute Class

Definition

Attribute annotated on ActionResult constructor and helper method parameters to indicate that the parameter is used to set the "statusCode" for the ActionResult.

Analyzers match this parameter by type name. This allows users to annotate custom results \ custom helpers with a user-defined attribute without having to expose this type.

This attribute is intentionally marked Inherited=false since the analyzer does not walk the inheritance graph.

public ref class ActionResultStatusCodeAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Parameter, AllowMultiple=false, Inherited=false)]
public sealed class ActionResultStatusCodeAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Parameter, AllowMultiple=false, Inherited=false)>]
type ActionResultStatusCodeAttribute = class
    inherit Attribute
Public NotInheritable Class ActionResultStatusCodeAttribute
Inherits Attribute
Inheritance
ActionResultStatusCodeAttribute
Attributes

Examples

Annotated constructor parameter:

public StatusCodeResult([ActionResultStatusCode] int statusCode)
{
    StatusCode = statusCode;
}

Constructors

ActionResultStatusCodeAttribute()

Applies to