Mono.Addins 0.4.0.0 1.0.0.0 System.Attribute Indicates that a field is bound to a node attribute

The [NodeAttribute] custom attribute can be used to specify fields that have to be initialized from node attributes. By default, a field is will get its value from an attribute with the same name, although it is possible to specify a different name by setting the NodeAttribute.Name property. NodeAttribute also has a Required property for specifying if an attribute is mandatory or not.

`public class FileTemplateNode: ExtensionNode { // Will match elements like <FileTemplate resource-name="blah" /> // The true parameter specifies that the attribute is required [NodeAttribute ("resource-name", true, Description="Name of the resource where the template is stored.")] string resource; [NodeAttribute] string name; public string Name { get { return name != null ? name : Id; } } public virtual string GetContent () { using (StreamReader sr = new StreamReader(Addin.GetResource (resource))) { return sr.ReadToEnd (); } } }`

If an subclass overrides the method to provide a custom node deserialization implementation, [NodeAttribute] attributes applied to fileds will be ignored. In this case, this attribute can also be applied at class level to provide documentation about the supported attributes. For example:

`[NodeAttribute ("name", typeof(string), false, Description="Name of the template.")] [NodeAttribute ("resource-name", typeof(string), true, Description="Name of the resource where the template is stored.")] public class FileTemplateNode: ExtensionNode { string resource; string name; public string Name { get { return name != null ? name : Id; } } public virtual string GetContent () { using (StreamReader sr = new StreamReader(Addin.GetResource (resource))) { return sr.ReadToEnd (); } } protected override void Read (NodeElement elem) { resource = elem.GetAttribute ("resource-name"); name = elem.GetAttribute ("name"); } }`
- Constructor
  Initializes a new instance.
  It takes the field name and type as name and type of the attribute.
  0.4.0.0
- Constructor
  XML name of the attribute.
  Initializes a new instance.
  0.4.0.0
- Constructor
  XML name of the attribute.
  Indicates whether the attribute is required or not.
  Initializes a new instance.
  0.4.0.0
- Constructor
  0.4.0.0
  To be added.
  To be added.
  To be added.
  To be added.
- Constructor
  XML name of the attribute.
  Type of the extension node attribute.
  Initializes a new instance.
  This constructor can only be used when applying [NodeAttribute] at class level.
  0.4.0.0
- Constructor
  0.4.0.0
  To be added.
  To be added.
  To be added.
  To be added.
  To be added.
- Constructor
  XML name of the attribute.
  Type of the extension node attribute.
  Indicates whether the attribute is required or not.
  Initializes a new instance.
  This constructor can only be used when applying [NodeAttribute] at class level.
  0.4.0.0
- Constructor
  0.4.0.0
  To be added.
  To be added.
  To be added.
  To be added.
  To be added.
- Constructor
  0.4.0.0
  To be added.
  To be added.
  To be added.
  To be added.
  To be added.
  To be added.
- Property
  System.String Description of the attribute. Description of the attribute. To be used in the extension point documentation. 0.4.0.0
- Property
  0.4.0.0
  System.Boolean To be added. To be added. To be added.
- Property
  System.String XML name of the attribute. XML name of the attribute.

  If the name is not specified, the field name to which the [NodeAttribute] is applied will be used as name.

  Providing a name is mandatory when applying [NodeAttribute] at class level.

  0.4.0.0
- Property
  System.Boolean Indicates whether the attribute is required or not. 'true' if the attribute is required. 0.4.0.0
- Property
  System.Type Type of the extension node attribute. A type. To be used only when applying [NodeAttribute] at class level. Not required when it is applied to a field, since the attribute type will be the type of the field. 0.4.0.0
System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Field | System.AttributeTargets.All, AllowMultiple=true)