mscorlib(4.0.0.0) API with additions
CodeAttributeDeclaration.cs
3 
4 namespace System.CodeDom
5 {
8  [ClassInterface(ClassInterfaceType.AutoDispatch)]
9  [ComVisible(true)]
11  {
12  private string name;
13 
15 
16  [OptionalField]
17  private CodeTypeReference attributeType;
18 
21  public string Name
22  {
23  get
24  {
25  if (name != null)
26  {
27  return name;
28  }
29  return string.Empty;
30  }
31  set
32  {
33  name = value;
34  attributeType = new CodeTypeReference(name);
35  }
36  }
37 
41 
44  public CodeTypeReference AttributeType => attributeType;
45 
48  {
49  }
50 
53  public CodeAttributeDeclaration(string name)
54  {
55  Name = name;
56  }
57 
61  public CodeAttributeDeclaration(string name, params CodeAttributeArgument[] arguments)
62  {
63  Name = name;
64  Arguments.AddRange(arguments);
65  }
66 
70  : this(attributeType, (CodeAttributeArgument[])null)
71  {
72  }
73 
77  public CodeAttributeDeclaration(CodeTypeReference attributeType, params CodeAttributeArgument[] arguments)
78  {
79  this.attributeType = attributeType;
80  if (attributeType != null)
81  {
82  name = attributeType.BaseType;
83  }
84  if (arguments != null)
85  {
86  Arguments.AddRange(arguments);
87  }
88  }
89  }
90 }
CodeAttributeDeclaration(CodeTypeReference attributeType)
Initializes a new instance of the T:System.CodeDom.CodeAttributeDeclaration class using the specified...
Represents a collection of T:System.CodeDom.CodeAttributeArgument objects.
string BaseType
Gets or sets the name of the type being referenced.
Definition: __Canon.cs:3
Represents an argument used in a metadata attribute declaration.
CodeAttributeArgumentCollection Arguments
Gets the arguments for the attribute.
Represents an attribute declaration.
CodeAttributeDeclaration(string name, params CodeAttributeArgument[] arguments)
Initializes a new instance of the T:System.CodeDom.CodeAttributeDeclaration class using the specified...
CodeAttributeDeclaration(string name)
Initializes a new instance of the T:System.CodeDom.CodeAttributeDeclaration class using the specified...
CodeAttributeDeclaration()
Initializes a new instance of the T:System.CodeDom.CodeAttributeDeclaration class.
void AddRange(CodeAttributeArgument[] value)
Copies the elements of the specified T:System.CodeDom.CodeAttributeArgument array to the end of the c...
CodeAttributeDeclaration(CodeTypeReference attributeType, params CodeAttributeArgument[] arguments)
Initializes a new instance of the T:System.CodeDom.CodeAttributeDeclaration class using the specified...
Specifies that the class can be serialized.
ClassInterfaceType
Identifies the type of class interface that is generated for a class.
Represents a reference to a type.
string Name
Gets or sets the name of the attribute being declared.
CodeTypeReference AttributeType
Gets the code type reference for the code attribute declaration.