mscorlib(4.0.0.0) API with additions
CustomAttributeData.cs
5 using System.Security;
6 
7 namespace System.Reflection
8 {
10  [Serializable]
11  [ComVisible(true)]
12  [__DynamicallyInvokable]
13  public class CustomAttributeData
14  {
15  private ConstructorInfo m_ctor;
16 
17  private RuntimeModule m_scope;
18 
19  private MemberInfo[] m_members;
20 
21  private CustomAttributeCtorParameter[] m_ctorParams;
22 
23  private CustomAttributeNamedParameter[] m_namedParams;
24 
25  private IList<CustomAttributeTypedArgument> m_typedCtorArgs;
26 
27  private IList<CustomAttributeNamedArgument> m_namedArgs;
28 
31  [__DynamicallyInvokable]
32  public Type AttributeType
33  {
34  [__DynamicallyInvokable]
35  get
36  {
38  }
39  }
40 
43  [ComVisible(true)]
44  public virtual ConstructorInfo Constructor
45  {
46  get
47  {
48  return m_ctor;
49  }
50  }
51 
54  [ComVisible(true)]
55  [__DynamicallyInvokable]
57  {
58  [__DynamicallyInvokable]
59  get
60  {
61  if (m_typedCtorArgs == null)
62  {
63  CustomAttributeTypedArgument[] array = new CustomAttributeTypedArgument[m_ctorParams.Length];
64  for (int i = 0; i < array.Length; i++)
65  {
66  CustomAttributeEncodedArgument customAttributeEncodedArgument = m_ctorParams[i].CustomAttributeEncodedArgument;
67  array[i] = new CustomAttributeTypedArgument(m_scope, m_ctorParams[i].CustomAttributeEncodedArgument);
68  }
69  m_typedCtorArgs = Array.AsReadOnly(array);
70  }
71  return m_typedCtorArgs;
72  }
73  }
74 
77  [__DynamicallyInvokable]
79  {
80  [__DynamicallyInvokable]
81  get
82  {
83  if (m_namedArgs == null)
84  {
85  if (m_namedParams == null)
86  {
87  return null;
88  }
89  int num = 0;
90  for (int i = 0; i < m_namedParams.Length; i++)
91  {
92  if (m_namedParams[i].EncodedArgument.CustomAttributeType.EncodedType != 0)
93  {
94  num++;
95  }
96  }
98  int j = 0;
99  int num2 = 0;
100  for (; j < m_namedParams.Length; j++)
101  {
102  if (m_namedParams[j].EncodedArgument.CustomAttributeType.EncodedType != 0)
103  {
104  array[num2++] = new CustomAttributeNamedArgument(m_members[j], new CustomAttributeTypedArgument(m_scope, m_namedParams[j].EncodedArgument));
105  }
106  }
107  m_namedArgs = Array.AsReadOnly(array);
108  }
109  return m_namedArgs;
110  }
111  }
112 
119  {
120  if (target == null)
121  {
122  throw new ArgumentNullException("target");
123  }
124  return target.GetCustomAttributesData();
125  }
126 
133  {
134  if (target == null)
135  {
136  throw new ArgumentNullException("target");
137  }
138  return target.GetCustomAttributesData();
139  }
140 
147  {
148  if (target == null)
149  {
150  throw new ArgumentNullException("target");
151  }
152  return target.GetCustomAttributesData();
153  }
154 
161  {
162  if (target == null)
163  {
164  throw new ArgumentNullException("target");
165  }
166  return target.GetCustomAttributesData();
167  }
168 
169  [SecuritySafeCritical]
170  internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimeType target)
171  {
172  IList<CustomAttributeData> customAttributes = GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken);
173  int count = 0;
174  Attribute[] customAttributes2 = PseudoCustomAttribute.GetCustomAttributes(target, typeof(object) as RuntimeType, includeSecCa: true, out count);
175  if (count == 0)
176  {
177  return customAttributes;
178  }
179  CustomAttributeData[] array = new CustomAttributeData[customAttributes.Count + count];
180  customAttributes.CopyTo(array, count);
181  for (int i = 0; i < count; i++)
182  {
183  array[i] = new CustomAttributeData(customAttributes2[i]);
184  }
185  return Array.AsReadOnly(array);
186  }
187 
188  [SecuritySafeCritical]
189  internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimeFieldInfo target)
190  {
191  IList<CustomAttributeData> customAttributes = GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken);
192  int count = 0;
193  Attribute[] customAttributes2 = PseudoCustomAttribute.GetCustomAttributes(target, typeof(object) as RuntimeType, out count);
194  if (count == 0)
195  {
196  return customAttributes;
197  }
198  CustomAttributeData[] array = new CustomAttributeData[customAttributes.Count + count];
199  customAttributes.CopyTo(array, count);
200  for (int i = 0; i < count; i++)
201  {
202  array[i] = new CustomAttributeData(customAttributes2[i]);
203  }
204  return Array.AsReadOnly(array);
205  }
206 
207  [SecuritySafeCritical]
208  internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimeMethodInfo target)
209  {
210  IList<CustomAttributeData> customAttributes = GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken);
211  int count = 0;
212  Attribute[] customAttributes2 = PseudoCustomAttribute.GetCustomAttributes(target, typeof(object) as RuntimeType, includeSecCa: true, out count);
213  if (count == 0)
214  {
215  return customAttributes;
216  }
217  CustomAttributeData[] array = new CustomAttributeData[customAttributes.Count + count];
218  customAttributes.CopyTo(array, count);
219  for (int i = 0; i < count; i++)
220  {
221  array[i] = new CustomAttributeData(customAttributes2[i]);
222  }
223  return Array.AsReadOnly(array);
224  }
225 
226  [SecuritySafeCritical]
227  internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimeConstructorInfo target)
228  {
229  return GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken);
230  }
231 
232  [SecuritySafeCritical]
233  internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimeEventInfo target)
234  {
235  return GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken);
236  }
237 
238  [SecuritySafeCritical]
239  internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimePropertyInfo target)
240  {
241  return GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken);
242  }
243 
244  [SecuritySafeCritical]
245  internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimeModule target)
246  {
247  if (target.IsResource())
248  {
249  return new List<CustomAttributeData>();
250  }
251  return GetCustomAttributes(target, target.MetadataToken);
252  }
253 
254  [SecuritySafeCritical]
255  internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimeAssembly target)
256  {
257  IList<CustomAttributeData> customAttributes = GetCustomAttributes((RuntimeModule)target.ManifestModule, RuntimeAssembly.GetToken(target.GetNativeHandle()));
258  int count = 0;
259  Attribute[] customAttributes2 = PseudoCustomAttribute.GetCustomAttributes(target, typeof(object) as RuntimeType, includeSecCa: false, out count);
260  if (count == 0)
261  {
262  return customAttributes;
263  }
264  CustomAttributeData[] array = new CustomAttributeData[customAttributes.Count + count];
265  customAttributes.CopyTo(array, count);
266  for (int i = 0; i < count; i++)
267  {
268  array[i] = new CustomAttributeData(customAttributes2[i]);
269  }
270  return Array.AsReadOnly(array);
271  }
272 
273  [SecuritySafeCritical]
274  internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimeParameterInfo target)
275  {
276  IList<CustomAttributeData> customAttributes = GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken);
277  int count = 0;
278  Attribute[] customAttributes2 = PseudoCustomAttribute.GetCustomAttributes(target, typeof(object) as RuntimeType, out count);
279  if (count == 0)
280  {
281  return customAttributes;
282  }
283  CustomAttributeData[] array = new CustomAttributeData[customAttributes.Count + count];
284  customAttributes.CopyTo(array, count);
285  for (int i = 0; i < count; i++)
286  {
287  array[i] = new CustomAttributeData(customAttributes2[i]);
288  }
289  return Array.AsReadOnly(array);
290  }
291 
292  private static CustomAttributeEncoding TypeToCustomAttributeEncoding(RuntimeType type)
293  {
294  if (type == (RuntimeType)typeof(int))
295  {
296  return CustomAttributeEncoding.Int32;
297  }
298  if (type.IsEnum)
299  {
300  return CustomAttributeEncoding.Enum;
301  }
302  if (type == (RuntimeType)typeof(string))
303  {
304  return CustomAttributeEncoding.String;
305  }
306  if (type == (RuntimeType)typeof(Type))
307  {
308  return CustomAttributeEncoding.Type;
309  }
310  if (type == (RuntimeType)typeof(object))
311  {
312  return CustomAttributeEncoding.Object;
313  }
314  if (type.IsArray)
315  {
316  return CustomAttributeEncoding.Array;
317  }
318  if (type == (RuntimeType)typeof(char))
319  {
320  return CustomAttributeEncoding.Char;
321  }
322  if (type == (RuntimeType)typeof(bool))
323  {
324  return CustomAttributeEncoding.Boolean;
325  }
326  if (type == (RuntimeType)typeof(byte))
327  {
328  return CustomAttributeEncoding.Byte;
329  }
330  if (type == (RuntimeType)typeof(sbyte))
331  {
332  return CustomAttributeEncoding.SByte;
333  }
334  if (type == (RuntimeType)typeof(short))
335  {
336  return CustomAttributeEncoding.Int16;
337  }
338  if (type == (RuntimeType)typeof(ushort))
339  {
340  return CustomAttributeEncoding.UInt16;
341  }
342  if (type == (RuntimeType)typeof(uint))
343  {
344  return CustomAttributeEncoding.UInt32;
345  }
346  if (type == (RuntimeType)typeof(long))
347  {
348  return CustomAttributeEncoding.Int64;
349  }
350  if (type == (RuntimeType)typeof(ulong))
351  {
352  return CustomAttributeEncoding.UInt64;
353  }
354  if (type == (RuntimeType)typeof(float))
355  {
356  return CustomAttributeEncoding.Float;
357  }
358  if (type == (RuntimeType)typeof(double))
359  {
360  return CustomAttributeEncoding.Double;
361  }
362  if (type == (RuntimeType)typeof(Enum))
363  {
364  return CustomAttributeEncoding.Object;
365  }
366  if (type.IsClass)
367  {
368  return CustomAttributeEncoding.Object;
369  }
370  if (type.IsInterface)
371  {
372  return CustomAttributeEncoding.Object;
373  }
374  if (type.IsValueType)
375  {
376  return CustomAttributeEncoding.Undefined;
377  }
378  throw new ArgumentException(Environment.GetResourceString("Argument_InvalidKindOfTypeForCA"), "type");
379  }
380 
381  private static CustomAttributeType InitCustomAttributeType(RuntimeType parameterType)
382  {
383  CustomAttributeEncoding customAttributeEncoding = TypeToCustomAttributeEncoding(parameterType);
384  CustomAttributeEncoding customAttributeEncoding2 = CustomAttributeEncoding.Undefined;
385  CustomAttributeEncoding encodedEnumType = CustomAttributeEncoding.Undefined;
386  string enumName = null;
387  if (customAttributeEncoding == CustomAttributeEncoding.Array)
388  {
389  parameterType = (RuntimeType)parameterType.GetElementType();
390  customAttributeEncoding2 = TypeToCustomAttributeEncoding(parameterType);
391  }
392  if (customAttributeEncoding == CustomAttributeEncoding.Enum || customAttributeEncoding2 == CustomAttributeEncoding.Enum)
393  {
394  encodedEnumType = TypeToCustomAttributeEncoding((RuntimeType)Enum.GetUnderlyingType(parameterType));
395  enumName = parameterType.AssemblyQualifiedName;
396  }
397  return new CustomAttributeType(customAttributeEncoding, customAttributeEncoding2, encodedEnumType, enumName);
398  }
399 
400  [SecurityCritical]
401  private static IList<CustomAttributeData> GetCustomAttributes(RuntimeModule module, int tkTarget)
402  {
403  CustomAttributeRecord[] customAttributeRecords = GetCustomAttributeRecords(module, tkTarget);
404  CustomAttributeData[] array = new CustomAttributeData[customAttributeRecords.Length];
405  for (int i = 0; i < customAttributeRecords.Length; i++)
406  {
407  array[i] = new CustomAttributeData(module, customAttributeRecords[i]);
408  }
409  return Array.AsReadOnly(array);
410  }
411 
412  [SecurityCritical]
413  internal static CustomAttributeRecord[] GetCustomAttributeRecords(RuntimeModule module, int targetToken)
414  {
415  MetadataImport metadataImport = module.MetadataImport;
416  metadataImport.EnumCustomAttributes(targetToken, out MetadataEnumResult result);
417  CustomAttributeRecord[] array = new CustomAttributeRecord[result.Length];
418  for (int i = 0; i < array.Length; i++)
419  {
420  metadataImport.GetCustomAttributeProps(result[i], out array[i].tkCtor.Value, out array[i].blob);
421  }
422  return array;
423  }
424 
425  internal static CustomAttributeTypedArgument Filter(IList<CustomAttributeData> attrs, Type caType, int parameter)
426  {
427  for (int i = 0; i < attrs.Count; i++)
428  {
429  if (attrs[i].Constructor.DeclaringType == caType)
430  {
431  return attrs[i].ConstructorArguments[parameter];
432  }
433  }
434  return default(CustomAttributeTypedArgument);
435  }
436 
439  {
440  }
441 
442  [SecuritySafeCritical]
443  private CustomAttributeData(RuntimeModule scope, CustomAttributeRecord caRecord)
444  {
445  m_scope = scope;
446  m_ctor = (RuntimeConstructorInfo)RuntimeType.GetMethodBase(scope, caRecord.tkCtor);
447  ParameterInfo[] parametersNoCopy = m_ctor.GetParametersNoCopy();
448  m_ctorParams = new CustomAttributeCtorParameter[parametersNoCopy.Length];
449  for (int i = 0; i < parametersNoCopy.Length; i++)
450  {
451  m_ctorParams[i] = new CustomAttributeCtorParameter(InitCustomAttributeType((RuntimeType)parametersNoCopy[i].ParameterType));
452  }
453  FieldInfo[] fields = m_ctor.DeclaringType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
454  PropertyInfo[] properties = m_ctor.DeclaringType.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
455  m_namedParams = new CustomAttributeNamedParameter[properties.Length + fields.Length];
456  for (int j = 0; j < fields.Length; j++)
457  {
458  m_namedParams[j] = new CustomAttributeNamedParameter(fields[j].Name, CustomAttributeEncoding.Field, InitCustomAttributeType((RuntimeType)fields[j].FieldType));
459  }
460  for (int k = 0; k < properties.Length; k++)
461  {
462  m_namedParams[k + fields.Length] = new CustomAttributeNamedParameter(properties[k].Name, CustomAttributeEncoding.Property, InitCustomAttributeType((RuntimeType)properties[k].PropertyType));
463  }
464  m_members = new MemberInfo[fields.Length + properties.Length];
465  fields.CopyTo(m_members, 0);
466  properties.CopyTo(m_members, fields.Length);
467  CustomAttributeEncodedArgument.ParseAttributeArguments(caRecord.blob, ref m_ctorParams, ref m_namedParams, m_scope);
468  }
469 
470  internal CustomAttributeData(Attribute attribute)
471  {
472  if (attribute is DllImportAttribute)
473  {
474  Init((DllImportAttribute)attribute);
475  }
476  else if (attribute is FieldOffsetAttribute)
477  {
478  Init((FieldOffsetAttribute)attribute);
479  }
480  else if (attribute is MarshalAsAttribute)
481  {
482  Init((MarshalAsAttribute)attribute);
483  }
484  else if (attribute is TypeForwardedToAttribute)
485  {
486  Init((TypeForwardedToAttribute)attribute);
487  }
488  else
489  {
490  Init(attribute);
491  }
492  }
493 
494  private void Init(DllImportAttribute dllImport)
495  {
496  Type typeFromHandle = typeof(DllImportAttribute);
497  m_ctor = typeFromHandle.GetConstructors(BindingFlags.Instance | BindingFlags.Public)[0];
498  m_typedCtorArgs = Array.AsReadOnly(new CustomAttributeTypedArgument[1]
499  {
500  new CustomAttributeTypedArgument(dllImport.Value)
501  });
502  m_namedArgs = Array.AsReadOnly(new CustomAttributeNamedArgument[8]
503  {
504  new CustomAttributeNamedArgument(typeFromHandle.GetField("EntryPoint"), dllImport.EntryPoint),
505  new CustomAttributeNamedArgument(typeFromHandle.GetField("CharSet"), dllImport.CharSet),
506  new CustomAttributeNamedArgument(typeFromHandle.GetField("ExactSpelling"), dllImport.ExactSpelling),
507  new CustomAttributeNamedArgument(typeFromHandle.GetField("SetLastError"), dllImport.SetLastError),
508  new CustomAttributeNamedArgument(typeFromHandle.GetField("PreserveSig"), dllImport.PreserveSig),
509  new CustomAttributeNamedArgument(typeFromHandle.GetField("CallingConvention"), dllImport.CallingConvention),
510  new CustomAttributeNamedArgument(typeFromHandle.GetField("BestFitMapping"), dllImport.BestFitMapping),
511  new CustomAttributeNamedArgument(typeFromHandle.GetField("ThrowOnUnmappableChar"), dllImport.ThrowOnUnmappableChar)
512  });
513  }
514 
515  private void Init(FieldOffsetAttribute fieldOffset)
516  {
517  m_ctor = typeof(FieldOffsetAttribute).GetConstructors(BindingFlags.Instance | BindingFlags.Public)[0];
518  m_typedCtorArgs = Array.AsReadOnly(new CustomAttributeTypedArgument[1]
519  {
520  new CustomAttributeTypedArgument(fieldOffset.Value)
521  });
522  m_namedArgs = Array.AsReadOnly(new CustomAttributeNamedArgument[0]);
523  }
524 
525  private void Init(MarshalAsAttribute marshalAs)
526  {
527  Type typeFromHandle = typeof(MarshalAsAttribute);
528  m_ctor = typeFromHandle.GetConstructors(BindingFlags.Instance | BindingFlags.Public)[0];
529  m_typedCtorArgs = Array.AsReadOnly(new CustomAttributeTypedArgument[1]
530  {
531  new CustomAttributeTypedArgument(marshalAs.Value)
532  });
533  int num = 3;
534  if (marshalAs.MarshalType != null)
535  {
536  num++;
537  }
538  if (marshalAs.MarshalTypeRef != null)
539  {
540  num++;
541  }
542  if (marshalAs.MarshalCookie != null)
543  {
544  num++;
545  }
546  num++;
547  num++;
548  if (marshalAs.SafeArrayUserDefinedSubType != null)
549  {
550  num++;
551  }
552  CustomAttributeNamedArgument[] array = new CustomAttributeNamedArgument[num];
553  num = 0;
554  array[num++] = new CustomAttributeNamedArgument(typeFromHandle.GetField("ArraySubType"), marshalAs.ArraySubType);
555  array[num++] = new CustomAttributeNamedArgument(typeFromHandle.GetField("SizeParamIndex"), marshalAs.SizeParamIndex);
556  array[num++] = new CustomAttributeNamedArgument(typeFromHandle.GetField("SizeConst"), marshalAs.SizeConst);
557  array[num++] = new CustomAttributeNamedArgument(typeFromHandle.GetField("IidParameterIndex"), marshalAs.IidParameterIndex);
558  array[num++] = new CustomAttributeNamedArgument(typeFromHandle.GetField("SafeArraySubType"), marshalAs.SafeArraySubType);
559  if (marshalAs.MarshalType != null)
560  {
561  array[num++] = new CustomAttributeNamedArgument(typeFromHandle.GetField("MarshalType"), marshalAs.MarshalType);
562  }
563  if (marshalAs.MarshalTypeRef != null)
564  {
565  array[num++] = new CustomAttributeNamedArgument(typeFromHandle.GetField("MarshalTypeRef"), marshalAs.MarshalTypeRef);
566  }
567  if (marshalAs.MarshalCookie != null)
568  {
569  array[num++] = new CustomAttributeNamedArgument(typeFromHandle.GetField("MarshalCookie"), marshalAs.MarshalCookie);
570  }
571  if (marshalAs.SafeArrayUserDefinedSubType != null)
572  {
573  array[num++] = new CustomAttributeNamedArgument(typeFromHandle.GetField("SafeArrayUserDefinedSubType"), marshalAs.SafeArrayUserDefinedSubType);
574  }
575  m_namedArgs = Array.AsReadOnly(array);
576  }
577 
578  private void Init(TypeForwardedToAttribute forwardedTo)
579  {
580  Type typeFromHandle = typeof(TypeForwardedToAttribute);
581  Type[] types = new Type[1]
582  {
583  typeof(Type)
584  };
585  m_ctor = typeFromHandle.GetConstructor(BindingFlags.Instance | BindingFlags.Public, null, types, null);
586  m_typedCtorArgs = Array.AsReadOnly(new CustomAttributeTypedArgument[1]
587  {
588  new CustomAttributeTypedArgument(typeof(Type), forwardedTo.Destination)
589  });
590  CustomAttributeNamedArgument[] array = new CustomAttributeNamedArgument[0];
591  m_namedArgs = Array.AsReadOnly(array);
592  }
593 
594  private void Init(object pca)
595  {
596  m_ctor = pca.GetType().GetConstructors(BindingFlags.Instance | BindingFlags.Public)[0];
597  m_typedCtorArgs = Array.AsReadOnly(new CustomAttributeTypedArgument[0]);
598  m_namedArgs = Array.AsReadOnly(new CustomAttributeNamedArgument[0]);
599  }
600 
603  public override string ToString()
604  {
605  string text = "";
606  for (int i = 0; i < ConstructorArguments.Count; i++)
607  {
608  text += string.Format(CultureInfo.CurrentCulture, (i == 0) ? "{0}" : ", {0}", ConstructorArguments[i]);
609  }
610  string text2 = "";
611  for (int j = 0; j < NamedArguments.Count; j++)
612  {
613  text2 += string.Format(CultureInfo.CurrentCulture, (j == 0 && text.Length == 0) ? "{0}" : ", {0}", NamedArguments[j]);
614  }
615  return string.Format(CultureInfo.CurrentCulture, "[{0}({1}{2})]", Constructor.DeclaringType.FullName, text, text2);
616  }
617 
620  public override int GetHashCode()
621  {
622  return base.GetHashCode();
623  }
624 
629  public override bool Equals(object obj)
630  {
631  return obj == this;
632  }
633  }
634 }
Obtains information about the attributes of a member and provides access to member metadata.
Definition: MemberInfo.cs:14
Performs reflection on a module.
Definition: Module.cs:17
FieldInfo [] GetFields()
Returns all the public fields of the current T:System.Type.
Definition: Type.cs:1695
Discovers the attributes of a parameter and provides access to parameter metadata.
string MarshalCookie
Provides additional information to a custom marshaler.
virtual IList< CustomAttributeNamedArgument > NamedArguments
Gets the list of named arguments specified for the attribute instance represented by the T:System....
bool PreserveSig
Indicates whether unmanaged methods that have HRESULT or retval return values are directly translated...
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
bool BestFitMapping
Enables or disables best-fit mapping behavior when converting Unicode characters to ANSI characters.
Represents a named argument of a custom attribute in the reflection-only context.
static IList< CustomAttributeData > GetCustomAttributes(ParameterInfo target)
Returns a list of T:System.Reflection.CustomAttributeData objects representing data about the attribu...
bool ThrowOnUnmappableChar
Enables or disables the throwing of an exception on an unmappable Unicode character that is converted...
short SizeParamIndex
Indicates the zero-based parameter that contains the count of array elements, similar to size_is in C...
abstract string FullName
Gets the fully qualified name of the type, including its namespace but not its assembly.
Definition: Type.cs:153
CallingConvention CallingConvention
Indicates the calling convention of an entry point.
VarEnum SafeArraySubType
Indicates the element type of the F:System.Runtime.InteropServices.UnmanagedType.SafeArray.
Discovers the attributes of a class constructor and provides access to constructor metadata.
Represents the base class for custom attributes.
Definition: Attribute.cs:15
abstract PropertyInfo [] GetProperties(BindingFlags bindingAttr)
When overridden in a derived class, searches for the properties of the current T:System....
BindingFlags
Specifies flags that control binding and the way in which the search for members and types is conduct...
Definition: BindingFlags.cs:10
Definition: __Canon.cs:3
Type MarshalTypeRef
Implements F:System.Runtime.InteropServices.MarshalAsAttribute.MarshalType as a type.
int Value
Gets the offset from the beginning of the structure to the beginning of the field.
Provides access to custom attribute data for assemblies, modules, types, members and parameters that ...
bool SetLastError
Indicates whether the callee calls the SetLastError Win32 API function before returning from the attr...
static IList< CustomAttributeData > GetCustomAttributes(MemberInfo target)
Returns a list of T:System.Reflection.CustomAttributeData objects representing data about the attribu...
void CopyTo(T[] array, int arrayIndex)
Copies the elements of the T:System.Collections.Generic.ICollection`1 to an T:System....
CustomAttributeData()
Initializes a new instance of the T:System.Reflection.CustomAttributeData class.
virtual IList< CustomAttributeData > GetCustomAttributesData()
Returns a list of T:System.Reflection.CustomAttributeData objects for the current parameter,...
Indicates that the attributed method is exposed by an unmanaged dynamic-link library (DLL) as a stati...
Indicates how to marshal the data between managed and unmanaged code.
Type AttributeType
Gets the type of the attribute.
override string ToString()
Returns a string representation of the custom attribute.
Represents an argument of a custom attribute in the reflection-only context, or an element of an arra...
Represents an assembly, which is a reusable, versionable, and self-describing building block of a com...
Definition: Assembly.cs:22
int SizeConst
Indicates the number of elements in the fixed-length array or the number of characters (not bytes) in...
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition: Array.cs:17
Represents type declarations: class types, interface types, array types, value types,...
Definition: Type.cs:18
Type SafeArrayUserDefinedSubType
Indicates the user-defined element type of the F:System.Runtime.InteropServices.UnmanagedType....
Indicates the physical position of fields within the unmanaged representation of a class or structure...
string Value
Gets the name of the DLL file that contains the entry point.
virtual IList< CustomAttributeData > GetCustomAttributesData()
Returns information about the attributes that have been applied to the current T:System....
Definition: Assembly.cs:1077
UnmanagedType Value
Gets the T:System.Runtime.InteropServices.UnmanagedType value the data is to be marshaled as.
Type DeclaringType
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo....
Represents a collection of objects that can be individually accessed by index.
Definition: IList.cs:9
bool ExactSpelling
Controls whether the F:System.Runtime.InteropServices.DllImportAttribute.CharSet field causes the com...
static CultureInfo CurrentCulture
Gets or sets the T:System.Globalization.CultureInfo object that represents the culture used by the cu...
Definition: CultureInfo.cs:120
static Attribute [] GetCustomAttributes(MemberInfo element, Type type)
Retrieves an array of the custom attributes applied to a member of a type. Parameters specify the mem...
Definition: Attribute.cs:346
int Count
Gets the number of elements contained in the T:System.Collections.Generic.ICollection`1.
Definition: ICollection.cs:15
Specifies a destination T:System.Type in another assembly.
virtual ConstructorInfo Constructor
Gets a T:System.Reflection.ConstructorInfo object that represents the constructor that would have ini...
CharSet CharSet
Indicates how to marshal string parameters to the method and controls name mangling.
Attribute can be applied to an enumeration.
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition: List.cs:14
virtual IList< CustomAttributeData > GetCustomAttributesData()
Returns a list of T:System.Reflection.CustomAttributeData objects representing data about the attribu...
Definition: MemberInfo.cs:126
static IList< CustomAttributeData > GetCustomAttributes(Assembly target)
Returns a list of T:System.Reflection.CustomAttributeData objects representing data about the attribu...
override bool Equals(object obj)
Returns a value that indicates whether this instance is equal to a specified object.
string EntryPoint
Indicates the name or ordinal of the DLL entry point to be called.
Specifies that the class can be serialized.
override int GetHashCode()
Serves as a hash function for a particular type.
Provides information about a specific culture (called a locale for unmanaged code development)....
Definition: CultureInfo.cs:16
ConstructorInfo [] GetConstructors()
Returns all the public constructors defined for the current T:System.Type.
Definition: Type.cs:1458
virtual IList< CustomAttributeTypedArgument > ConstructorArguments
Gets the list of positional arguments specified for the attribute instance represented by the T:Syste...
UnmanagedType ArraySubType
Specifies the element type of the unmanaged F:System.Runtime.InteropServices.UnmanagedType....
int IidParameterIndex
Specifies the parameter index of the unmanaged iid_is attribute used by COM.
Type Destination
Gets the destination T:System.Type in another assembly.
string MarshalType
Specifies the fully qualified name of a custom marshaler.
static IList< CustomAttributeData > GetCustomAttributes(Module target)
Returns a list of T:System.Reflection.CustomAttributeData objects representing data about the attribu...
virtual IList< CustomAttributeData > GetCustomAttributesData()
Returns a list of T:System.Reflection.CustomAttributeData objects for the current module,...
Definition: Module.cs:252