public static bool GetAttributeTypeAndConstructor(this MetadataReader metadataReader, CustomAttributeHandle attributeHandle, out Handle attributeType, out Handle attributeCtor) { CustomAttribute attribute = metadataReader.GetCustomAttribute(attributeHandle); attributeCtor = attribute.Constructor; attributeType = attribute.GetAttributeTypeHandle(metadataReader); return true; }
public static bool GetAttributeNamespaceAndName(this MetadataReader metadataReader, CustomAttributeHandle attributeHandle, out string namespaceString, out ConstantStringValueHandle nameHandle) { Handle attributeType, attributeCtor; if (!GetAttributeTypeAndConstructor(metadataReader, attributeHandle, out attributeType, out attributeCtor)) { namespaceString = null; nameHandle = default(ConstantStringValueHandle); return false; } return GetAttributeTypeNamespaceAndName(metadataReader, attributeType, out namespaceString, out nameHandle); }
} // Read public static uint Read(this NativeReader reader, uint offset, out CustomAttributeHandle[] values) { uint count; offset = reader.DecodeUnsigned(offset, out count); if (count == 0) { values = s_emptyCustomAttributeHandleArray; } else { values = new CustomAttributeHandle[count]; for (uint i = 0; i < count; ++i) { CustomAttributeHandle tmp; offset = reader.Read(offset, out tmp); values[i] = tmp; } } return offset; } // Read
} // Read public static uint Read(this NativeReader reader, uint offset, out CustomAttributeHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new CustomAttributeHandle((int)value); handle._Validate(); return offset; } // Read
internal RuntimeNormalCustomAttributeData(MetadataReader reader, CustomAttributeHandle customAttributeHandle) { _reader = reader; _customAttribute = customAttributeHandle.GetCustomAttribute(reader); }
} // IsNull internal bool IsNull(CustomAttributeHandle handle) { return (handle._value & 0x00FFFFFF) == 0; } // IsNull
} // ToHandle internal Handle ToHandle(CustomAttributeHandle handle) { return new Handle(handle._value); } // ToHandle
} // GetConstantUInt64Value public CustomAttribute GetCustomAttribute(CustomAttributeHandle handle) { var record = new CustomAttribute() { _reader = this, _handle = handle }; var offset = (uint)handle.Offset; offset = _streamReader.Read(offset, out record._constructor); offset = _streamReader.Read(offset, out record._fixedArguments); offset = _streamReader.Read(offset, out record._namedArguments); return record; } // GetCustomAttribute
} // Equals public bool Equals(CustomAttributeHandle handle) { return _value == handle._value; } // Equals
} // Read public static uint Read(this NativeReader reader, uint offset, out CustomAttributeHandle[] values) { uint count; offset = reader.DecodeUnsigned(offset, out count); #if !NETFX_45 if (count == 0) { values = Array.Empty<CustomAttributeHandle>(); } else #endif { values = new CustomAttributeHandle[count]; for (uint i = 0; i < count; ++i) { CustomAttributeHandle tmp; offset = reader.Read(offset, out tmp); values[i] = tmp; } } return offset; } // Read
internal NativeFormatCustomAttributeData(MetadataReader reader, CustomAttributeHandle customAttributeHandle) { _reader = reader; _customAttribute = customAttributeHandle.GetCustomAttribute(reader); }