Show / Hide Table of Contents

Interface ICustomAttribute

Represents the custom attribute data

Namespace: CilTools.Reflection
Assembly: CilTools.BytecodeAnalysis.dll
Syntax
public interface ICustomAttribute
Remarks

This interface is needed to support fetching custom attribute data in reflection-only mode in .NET Framework 3.5. The library treats objects that implement ICustomAttribute in a special way when processing an array returned by MethodBase.GetCustomAttributes, fetching raw attribute data instead of attempting to emulate that data based on what reflection returns for an attribute type. Implement this interface when you need to pass your custom method object to APIs like CilGraph and make it possible to read raw data of method's custom attributes.

Properties

Constructor

Gets the constructor used to instantiate object of this attribute

Declaration
MethodBase Constructor { get; }
Property Value
Type Description
System.Reflection.MethodBase

Data

Gets the raw attribute data as the byte array

Declaration
byte[] Data { get; }
Property Value
Type Description
System.Byte[]
Remarks

The format of the byte array is defined by ECMA-335 specification, paragraph II.23.3 - Custom attributes. The data in the byte array specifies constructor's arguments and property values used to create an object for this attribute.

Owner

Gets the method this attribute is attached to

Declaration
MethodBase Owner { get; }
Property Value
Type Description
System.Reflection.MethodBase
Back to top CIL Tools (published from sources in GitHub repository).
Generated by DocFX