ViewComponentAttribute Class¶
Indicates the class and all subclasses are view components. Optionally specifies a view component’s name. If defining a base class for multiple view components, associate this attribute with that base.
- Namespace
Microsoft.AspNetCore.Mvc
- Assemblies
- Microsoft.AspNetCore.Mvc.ViewFeatures
Inheritance Hierarchy¶
System.Object
System.Attribute
Microsoft.AspNetCore.Mvc.ViewComponentAttribute
Syntax¶
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
public class ViewComponentAttribute : Attribute, _Attribute
-
class
Microsoft.AspNetCore.Mvc.
ViewComponentAttribute
Properties¶
-
Microsoft.AspNetCore.Mvc.ViewComponentAttribute.
Name
¶ Gets or sets the name of the view component. Do not supply a name in an attribute associated with a view component base class.
Return type: System.String public string Name { get; set; }
-