using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Text; namespace System.Reflection { /// Provides access to custom attribute data for assemblies, modules, types, members and parameters that are loaded into the reflection-only context. // Token: 0x02000239 RID: 569 [ComVisible(true)] [Serializable] public sealed class CustomAttributeData { // Token: 0x06001DD5 RID: 7637 RVA: 0x0006FCE8 File Offset: 0x0006DEE8 internal CustomAttributeData(ConstructorInfo ctorInfo, object[] ctorArgs, object[] namedArgs) { this.ctorInfo = ctorInfo; this.ctorArgs = Array.AsReadOnly((ctorArgs == null) ? new CustomAttributeTypedArgument[0] : CustomAttributeData.UnboxValues(ctorArgs)); this.namedArgs = Array.AsReadOnly((namedArgs == null) ? new CustomAttributeNamedArgument[0] : CustomAttributeData.UnboxValues(namedArgs)); } /// Returns a object representing the constructor that would have initialized the custom attribute. /// A object representing the constructor that would have initialized the custom attribute represented by the current instance of the class. // Token: 0x1700055E RID: 1374 // (get) Token: 0x06001DD6 RID: 7638 RVA: 0x0006FD48 File Offset: 0x0006DF48 [ComVisible(true)] public ConstructorInfo Constructor { get { return this.ctorInfo; } } /// Gets the list of positional arguments specified for the attribute instance represented by the object. /// An of structures representing the positional arguments specified for the custom attribute instance. // Token: 0x1700055F RID: 1375 // (get) Token: 0x06001DD7 RID: 7639 RVA: 0x0006FD50 File Offset: 0x0006DF50 [ComVisible(true)] public IList ConstructorArguments { get { return this.ctorArgs; } } /// Gets the list of named arguments specified for the attribute instance represented by the object. /// An of structures representing the named arguments specified for the custom attribute instance. // Token: 0x17000560 RID: 1376 // (get) Token: 0x06001DD8 RID: 7640 RVA: 0x0006FD58 File Offset: 0x0006DF58 public IList NamedArguments { get { return this.namedArgs; } } /// Returns a list of objects representing data about the attributes that have been applied to the target assembly. /// An of objects representing data about the attributes that have been applied to the target assembly. /// The assembly whose custom attribute data is to be retrieved. /// /// is null. // Token: 0x06001DD9 RID: 7641 RVA: 0x0006FD60 File Offset: 0x0006DF60 public static IList GetCustomAttributes(Assembly target) { return MonoCustomAttrs.GetCustomAttributesData(target); } /// Returns a list of objects representing data about the attributes that have been applied to the target member. /// An of objects representing data about the attributes that have been applied to the target member. /// A object representing the member whose attribute data is to be retrieved. /// /// is null. // Token: 0x06001DDA RID: 7642 RVA: 0x0006FD68 File Offset: 0x0006DF68 public static IList GetCustomAttributes(MemberInfo target) { return MonoCustomAttrs.GetCustomAttributesData(target); } /// Returns a list of objects representing data about the attributes that have been applied to the target module. /// An of objects representing data about the attributes that have been applied to the target module. /// The module whose custom attribute data is to be retrieved. /// /// is null. // Token: 0x06001DDB RID: 7643 RVA: 0x0006FD70 File Offset: 0x0006DF70 public static IList GetCustomAttributes(Module target) { return MonoCustomAttrs.GetCustomAttributesData(target); } /// Returns a list of objects representing data about the attributes that have been applied to the target parameter. /// An of objects representing data about the attributes that have been applied to the target parameter. /// A object representing the parameter whose attribute data is to be retrieved. /// /// is null. // Token: 0x06001DDC RID: 7644 RVA: 0x0006FD78 File Offset: 0x0006DF78 public static IList GetCustomAttributes(ParameterInfo target) { return MonoCustomAttrs.GetCustomAttributesData(target); } /// Returns a string representation of the custom attribute. /// A string value that represents the custom attribute. // Token: 0x06001DDD RID: 7645 RVA: 0x0006FD80 File Offset: 0x0006DF80 public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("[" + this.ctorInfo.DeclaringType.FullName + "("); for (int i = 0; i < this.ctorArgs.Count; i++) { stringBuilder.Append(this.ctorArgs[i].ToString()); if (i + 1 < this.ctorArgs.Count) { stringBuilder.Append(", "); } } if (this.namedArgs.Count > 0) { stringBuilder.Append(", "); } for (int j = 0; j < this.namedArgs.Count; j++) { stringBuilder.Append(this.namedArgs[j].ToString()); if (j + 1 < this.namedArgs.Count) { stringBuilder.Append(", "); } } stringBuilder.AppendFormat(")]", new object[0]); return stringBuilder.ToString(); } // Token: 0x06001DDE RID: 7646 RVA: 0x0006FE9C File Offset: 0x0006E09C private static T[] UnboxValues(object[] values) { T[] array = new T[values.Length]; for (int i = 0; i < values.Length; i++) { array[i] = (T)((object)values[i]); } return array; } /// // Token: 0x06001DDF RID: 7647 RVA: 0x0006FED8 File Offset: 0x0006E0D8 public override bool Equals(object obj) { CustomAttributeData customAttributeData = obj as CustomAttributeData; if (customAttributeData == null || customAttributeData.ctorInfo != this.ctorInfo || customAttributeData.ctorArgs.Count != this.ctorArgs.Count || customAttributeData.namedArgs.Count != this.namedArgs.Count) { return false; } for (int i = 0; i < this.ctorArgs.Count; i++) { if (this.ctorArgs[i].Equals(customAttributeData.ctorArgs[i])) { return false; } } for (int j = 0; j < this.namedArgs.Count; j++) { bool flag = false; for (int k = 0; k < customAttributeData.namedArgs.Count; k++) { if (this.namedArgs[j].Equals(customAttributeData.namedArgs[k])) { flag = true; break; } } if (!flag) { return false; } } return true; } // Token: 0x06001DE0 RID: 7648 RVA: 0x00070000 File Offset: 0x0006E200 public override int GetHashCode() { int num = this.ctorInfo.GetHashCode() << 16; for (int i = 0; i < this.ctorArgs.Count; i++) { num += num ^ (7 + this.ctorArgs[i].GetHashCode() << i * 4); } for (int j = 0; j < this.namedArgs.Count; j++) { num += this.namedArgs[j].GetHashCode() << 5; } return num; } // Token: 0x04000A21 RID: 2593 private ConstructorInfo ctorInfo; // Token: 0x04000A22 RID: 2594 private IList ctorArgs; // Token: 0x04000A23 RID: 2595 private IList namedArgs; } }