1 <?xml version="1.0" encoding="utf-8"?>
2 <Type Name="CustomAttributeData" FullName="System.Reflection.CustomAttributeData">
3 <TypeSignature Language="C#" Value="public class CustomAttributeData" />
4 <TypeSignature Language="ILAsm" Value=".class public auto ansi serializable beforefieldinit CustomAttributeData extends System.Object" />
6 <AssemblyName>mscorlib</AssemblyName>
7 <AssemblyVersion>2.0.0.0</AssemblyVersion>
8 <AssemblyVersion>4.0.0.0</AssemblyVersion>
11 <BaseTypeName>System.Object</BaseTypeName>
16 <AttributeName>System.Runtime.InteropServices.ComVisible(true)</AttributeName>
20 <since version=".NET 2.0" />
22 <attribution license="cc4" from="Microsoft" modified="false" />
23 <para>Code that is being examined in the reflection-only context cannot be executed, so it is not always possible to examine custom attributes by creating instances of them and then examining their properties, using methods like <see cref="Overload:System.Attribute.GetCustomAttributes" />, <see cref="Overload:System.Reflection.MemberInfo.GetCustomAttributes" />, and so on. If the code for the attribute type itself is loaded into the reflection-only context, it cannot be executed. </para>
24 <para>The <see cref="T:System.Reflection.CustomAttributeData" /> class allows examination of custom attributes in the reflection-only context by providing an abstraction for attributes. The members of this class can be used to obtain the positional arguments and named arguments of the attribute. Use the <see cref="P:System.Reflection.CustomAttributeData.ConstructorArguments" /> property to get a list of <see cref="T:System.Reflection.CustomAttributeTypedArgument" /> structures that represent the positional arguments, and use the <see cref="P:System.Reflection.CustomAttributeData.NamedArguments" /> property to get a list of <see cref="T:System.Reflection.CustomAttributeNamedArgument" /> structures that represent the named arguments. </para>
25 <block subset="none" type="note">
26 <para>The <see cref="T:System.Reflection.CustomAttributeNamedArgument" /> structure only provides information about the attribute property used to get and set the argument value. To obtain the type and value of the argument, use the <see cref="P:System.Reflection.CustomAttributeNamedArgument.TypedValue" /> property to obtain a <see cref="T:System.Reflection.CustomAttributeTypedArgument" /> structure.</para>
28 <para>When you have a <see cref="T:System.Reflection.CustomAttributeTypedArgument" /> structure for an argument, whether named or positional, use the <see cref="P:System.Reflection.CustomAttributeTypedArgument.ArgumentType" /> property to get the type and the <see cref="P:System.Reflection.CustomAttributeTypedArgument.Value" /> property to get the value. </para>
29 <block subset="none" type="note">
30 <para>For an array argument, the <see cref="P:System.Reflection.CustomAttributeTypedArgument.Value" /> property returns a generic <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> of <see cref="T:System.Reflection.CustomAttributeTypedArgument" /> objects. Each <see cref="T:System.Reflection.CustomAttributeTypedArgument" /> object in the collection represents the corresponding element of the array. </para>
33 <see cref="T:System.Reflection.CustomAttributeData" /> can be used in the execution context as well as in the reflection-only context. For example, you might want to avoid loading the assembly that contains the code for a custom attribute. Using the <see cref="T:System.Reflection.CustomAttributeData" /> class is different from using methods like <see cref="Overload:System.Attribute.GetCustomAttributes" />:</para>
36 <para>The properties and methods of <see cref="T:System.Reflection.CustomAttributeData" /> only provide you with the values that were specified for the attribute instance, not the semantics of the constructor. For example, a string argument of an attribute might be converted internally to some other representation, and returned in a canonical form; or a property might have side effects when the actual attribute code is executed.</para>
39 <para>The properties and methods of <see cref="T:System.Reflection.CustomAttributeData" /> do not allow you to retrieve the custom attributes inherited from base classes. </para>
42 <para>To create instances of the <see cref="T:System.Reflection.CustomAttributeData" /> class, use the static (Shared in Visual Basic) <see cref="Overload:System.Reflection.CustomAttributeData.GetCustomAttributes" /> factory methods.</para>
45 <attribution license="cc4" from="Microsoft" modified="false" />
46 <para>Provides access to custom attribute data for assemblies, modules, types, members and parameters that are loaded into the reflection-only context.</para>
50 <Member MemberName=".ctor">
51 <MemberSignature Language="C#" Value="protected CustomAttributeData ();" />
52 <MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor() cil managed" />
53 <MemberType>Constructor</MemberType>
55 <AssemblyVersion>4.0.0.0</AssemblyVersion>
60 <attribution license="cc4" from="Microsoft" modified="false" />
61 <para>This constructor is invoked by derived classes during the construction of <see cref="T:System.Reflection.CustomAttributeData" /> objects.</para>
64 <attribution license="cc4" from="Microsoft" modified="false" />
65 <para>Initializes a new instance of the <see cref="T:System.Reflection.CustomAttributeData" /> class.</para>
69 <Member MemberName="AttributeType">
70 <MemberSignature Language="C#" Value="public Type AttributeType { get; }" />
71 <MemberSignature Language="ILAsm" Value=".property instance class System.Type AttributeType" />
72 <MemberType>Property</MemberType>
74 <AssemblyVersion>4.0.0.0</AssemblyVersion>
77 <ReturnType>System.Type</ReturnType>
80 <value>To be added.</value>
81 <remarks>To be added.</remarks>
83 <attribution license="cc4" from="Microsoft" modified="false" />
84 <para>Gets the type of the attribute.</para>
88 <Member MemberName="Constructor">
89 <MemberSignature Language="C#" Value="public virtual System.Reflection.ConstructorInfo Constructor { get; }" />
90 <MemberSignature Language="ILAsm" Value=".property instance class System.Reflection.ConstructorInfo Constructor" />
91 <MemberType>Property</MemberType>
93 <AssemblyVersion>2.0.0.0</AssemblyVersion>
94 <AssemblyVersion>4.0.0.0</AssemblyVersion>
98 <AttributeName>System.Runtime.InteropServices.ComVisible(true)</AttributeName>
102 <ReturnType>System.Reflection.ConstructorInfo</ReturnType>
105 <value>To be added.</value>
106 <since version=".NET 2.0" />
108 <attribution license="cc4" from="Microsoft" modified="false" />
109 <para>If an attribute type has multiple constructors, this property returns only the particular constructor that would have initialized the attribute instance represented by the current <see cref="T:System.Reflection.CustomAttributeData" /> object.</para>
112 <attribution license="cc4" from="Microsoft" modified="false" />
113 <para>Gets a <see cref="T:System.Reflection.ConstructorInfo" /> object that represents the constructor that would have initialized the custom attribute.</para>
117 <Member MemberName="ConstructorArguments">
118 <MemberSignature Language="C#" Value="public virtual System.Collections.Generic.IList<System.Reflection.CustomAttributeTypedArgument> ConstructorArguments { get; }" />
119 <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IList`1<valuetype System.Reflection.CustomAttributeTypedArgument> ConstructorArguments" />
120 <MemberType>Property</MemberType>
122 <AssemblyVersion>2.0.0.0</AssemblyVersion>
123 <AssemblyVersion>4.0.0.0</AssemblyVersion>
127 <AttributeName>System.Runtime.InteropServices.ComVisible(true)</AttributeName>
131 <ReturnType>System.Collections.Generic.IList<System.Reflection.CustomAttributeTypedArgument></ReturnType>
134 <value>To be added.</value>
135 <since version=".NET 2.0" />
137 <attribution license="cc4" from="Microsoft" modified="false" />
138 <para>This method gets the positional arguments that were specified for the custom attribute instance without executing any of the custom attribute code. Thus, it can be used in the reflection-only context.</para>
139 <para>Use the <see cref="P:System.Reflection.CustomAttributeData.NamedArguments" /> method to get the named arguments specified for the attribute instance.</para>
142 <attribution license="cc4" from="Microsoft" modified="false" />
143 <para>Gets the list of positional arguments specified for the attribute instance represented by the <see cref="T:System.Reflection.CustomAttributeData" /> object.</para>
147 <Member MemberName="Equals">
148 <MemberSignature Language="C#" Value="public override bool Equals (object obj);" />
149 <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance bool Equals(object obj) cil managed" />
150 <MemberType>Method</MemberType>
152 <AssemblyVersion>2.0.0.0</AssemblyVersion>
153 <AssemblyVersion>4.0.0.0</AssemblyVersion>
156 <ReturnType>System.Boolean</ReturnType>
159 <Parameter Name="obj" Type="System.Object" />
162 <remarks>To be added.</remarks>
164 <attribution license="cc4" from="Microsoft" modified="false" />
165 <para>Returns a value that indicates whether this instance is equal to a specified object.</para>
168 <attribution license="cc4" from="Microsoft" modified="false" />
169 <para>true if <paramref name="obj" /> is equal to the current instance; otherwise, false.</para>
172 <attribution license="cc4" from="Microsoft" modified="false" />An object to compare with this instance, or null.</param>
175 <Member MemberName="GetCustomAttributes">
176 <MemberSignature Language="C#" Value="public static System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributes (System.Reflection.Assembly target);" />
177 <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Collections.Generic.IList`1<class System.Reflection.CustomAttributeData> GetCustomAttributes(class System.Reflection.Assembly target) cil managed" />
178 <MemberType>Method</MemberType>
180 <AssemblyVersion>2.0.0.0</AssemblyVersion>
181 <AssemblyVersion>4.0.0.0</AssemblyVersion>
184 <ReturnType>System.Collections.Generic.IList<System.Reflection.CustomAttributeData></ReturnType>
187 <Parameter Name="target" Type="System.Reflection.Assembly" />
190 <since version=".NET 2.0" />
192 <attribution license="cc4" from="Microsoft" modified="false" />
193 <para>This method provides an alternative to the <see cref="Overload:System.Reflection.Assembly.GetCustomAttributes" /> method that can always be used in the Reflection-only context.</para>
196 <attribution license="cc4" from="Microsoft" modified="false" />
197 <para>Returns a list of <see cref="T:System.Reflection.CustomAttributeData" /> objects representing data about the attributes that have been applied to the target assembly.</para>
200 <attribution license="cc4" from="Microsoft" modified="false" />
201 <para>A list of objects that represent data about the attributes that have been applied to the target assembly.</para>
203 <param name="target">
204 <attribution license="cc4" from="Microsoft" modified="false" />The assembly whose custom attribute data is to be retrieved.</param>
207 <Member MemberName="GetCustomAttributes">
208 <MemberSignature Language="C#" Value="public static System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributes (System.Reflection.MemberInfo target);" />
209 <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Collections.Generic.IList`1<class System.Reflection.CustomAttributeData> GetCustomAttributes(class System.Reflection.MemberInfo target) cil managed" />
210 <MemberType>Method</MemberType>
212 <AssemblyVersion>2.0.0.0</AssemblyVersion>
213 <AssemblyVersion>4.0.0.0</AssemblyVersion>
216 <ReturnType>System.Collections.Generic.IList<System.Reflection.CustomAttributeData></ReturnType>
219 <Parameter Name="target" Type="System.Reflection.MemberInfo" />
222 <since version=".NET 2.0" />
224 <attribution license="cc4" from="Microsoft" modified="false" />
225 <para>This method overload gets custom attribute data for types, nested types, and type members, because the <see cref="T:System.Type" /> class and the classes in the <see cref="N:System.Reflection" /> namespace that represent type members all derive from <see cref="T:System.Reflection.MemberInfo" />. </para>
228 <attribution license="cc4" from="Microsoft" modified="false" />
229 <para>Returns a list of <see cref="T:System.Reflection.CustomAttributeData" /> objects representing data about the attributes that have been applied to the target member.</para>
232 <attribution license="cc4" from="Microsoft" modified="false" />
233 <para>A list of objects that represent data about the attributes that have been applied to the target member.</para>
235 <param name="target">
236 <attribution license="cc4" from="Microsoft" modified="false" />The member whose attribute data is to be retrieved.</param>
239 <Member MemberName="GetCustomAttributes">
240 <MemberSignature Language="C#" Value="public static System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributes (System.Reflection.Module target);" />
241 <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Collections.Generic.IList`1<class System.Reflection.CustomAttributeData> GetCustomAttributes(class System.Reflection.Module target) cil managed" />
242 <MemberType>Method</MemberType>
244 <AssemblyVersion>2.0.0.0</AssemblyVersion>
245 <AssemblyVersion>4.0.0.0</AssemblyVersion>
248 <ReturnType>System.Collections.Generic.IList<System.Reflection.CustomAttributeData></ReturnType>
251 <Parameter Name="target" Type="System.Reflection.Module" />
254 <remarks>To be added.</remarks>
255 <since version=".NET 2.0" />
257 <attribution license="cc4" from="Microsoft" modified="false" />
258 <para>Returns a list of <see cref="T:System.Reflection.CustomAttributeData" /> objects representing data about the attributes that have been applied to the target module.</para>
261 <attribution license="cc4" from="Microsoft" modified="false" />
262 <para>A list of objects that represent data about the attributes that have been applied to the target module.</para>
264 <param name="target">
265 <attribution license="cc4" from="Microsoft" modified="false" />The module whose custom attribute data is to be retrieved.</param>
268 <Member MemberName="GetCustomAttributes">
269 <MemberSignature Language="C#" Value="public static System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributes (System.Reflection.ParameterInfo target);" />
270 <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Collections.Generic.IList`1<class System.Reflection.CustomAttributeData> GetCustomAttributes(class System.Reflection.ParameterInfo target) cil managed" />
271 <MemberType>Method</MemberType>
273 <AssemblyVersion>2.0.0.0</AssemblyVersion>
274 <AssemblyVersion>4.0.0.0</AssemblyVersion>
277 <ReturnType>System.Collections.Generic.IList<System.Reflection.CustomAttributeData></ReturnType>
280 <Parameter Name="target" Type="System.Reflection.ParameterInfo" />
283 <since version=".NET 2.0" />
285 <attribution license="cc4" from="Microsoft" modified="false" />
286 <para>This method provides an alternative to the <see cref="Overload:System.Reflection.ParameterInfo.GetCustomAttributes" /> method that can always be used in the Reflection-only context.</para>
289 <attribution license="cc4" from="Microsoft" modified="false" />
290 <para>Returns a list of <see cref="T:System.Reflection.CustomAttributeData" /> objects representing data about the attributes that have been applied to the target parameter.</para>
293 <attribution license="cc4" from="Microsoft" modified="false" />
294 <para>A list of objects that represent data about the attributes that have been applied to the target parameter.</para>
296 <param name="target">
297 <attribution license="cc4" from="Microsoft" modified="false" />The parameter whose attribute data is to be retrieved.</param>
300 <Member MemberName="GetHashCode">
301 <MemberSignature Language="C#" Value="public override int GetHashCode ();" />
302 <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance int32 GetHashCode() cil managed" />
303 <MemberType>Method</MemberType>
305 <AssemblyVersion>2.0.0.0</AssemblyVersion>
306 <AssemblyVersion>4.0.0.0</AssemblyVersion>
309 <ReturnType>System.Int32</ReturnType>
313 <summary>To be added.</summary>
314 <returns>To be added.</returns>
315 <remarks>To be added.</remarks>
318 <Member MemberName="NamedArguments">
319 <MemberSignature Language="C#" Value="public virtual System.Collections.Generic.IList<System.Reflection.CustomAttributeNamedArgument> NamedArguments { get; }" />
320 <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IList`1<valuetype System.Reflection.CustomAttributeNamedArgument> NamedArguments" />
321 <MemberType>Property</MemberType>
323 <AssemblyVersion>2.0.0.0</AssemblyVersion>
324 <AssemblyVersion>4.0.0.0</AssemblyVersion>
327 <ReturnType>System.Collections.Generic.IList<System.Reflection.CustomAttributeNamedArgument></ReturnType>
330 <value>To be added.</value>
331 <since version=".NET 2.0" />
333 <attribution license="cc4" from="Microsoft" modified="false" />
334 <para>This method gets the named arguments that were specified for the custom attribute instance without executing any of the custom attribute code. Thus, it can be used in the Reflection-only context. </para>
335 <para>The list that is returned contains only the named arguments that were specified for the attribute instance.</para>
336 <para>Use the <see cref="P:System.Reflection.CustomAttributeData.ConstructorArguments" /> method to get the positional arguments that were specified for the attribute instance. </para>
339 <attribution license="cc4" from="Microsoft" modified="false" />
340 <para>Gets the list of named arguments specified for the attribute instance represented by the <see cref="T:System.Reflection.CustomAttributeData" /> object.</para>
344 <Member MemberName="ToString">
345 <MemberSignature Language="C#" Value="public override string ToString ();" />
346 <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance string ToString() cil managed" />
347 <MemberType>Method</MemberType>
349 <AssemblyVersion>2.0.0.0</AssemblyVersion>
350 <AssemblyVersion>4.0.0.0</AssemblyVersion>
353 <ReturnType>System.String</ReturnType>
357 <since version=".NET 2.0" />
359 <attribution license="cc4" from="Microsoft" modified="false" />
360 <para>The string value includes the attribute type, the attribute parameters, and the named parameters.</para>
363 <attribution license="cc4" from="Microsoft" modified="false" />
364 <para>Returns a string representation of the custom attribute.</para>
367 <attribution license="cc4" from="Microsoft" modified="false" />
368 <para>A string value that represents the custom attribute.</para>