Class EventDefinition
- Namespace
- AsmResolver.DotNet
- Assembly
- AsmResolver.DotNet.dll
Represents a single event in a type definition of a .NET module.
public class EventDefinition : MetadataMember, IHasSemantics, IMemberDefinition, IMemberDescriptor, IFullNameProvider, INameProvider, IModuleProvider, IImportable, IHasCustomAttribute, IMetadataMember, IOwnedCollectionElement<TypeDefinition>
- Inheritance
-
EventDefinition
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
EventDefinition(MetadataToken)
Initializes a new property definition.
protected EventDefinition(MetadataToken token)
Parameters
token
MetadataTokenThe token of the property.
EventDefinition(Utf8String?, EventAttributes, ITypeDefOrRef?)
Creates a new property definition.
public EventDefinition(Utf8String? name, EventAttributes attributes, ITypeDefOrRef? eventType)
Parameters
name
Utf8StringThe name of the property.
attributes
EventAttributesThe attributes.
eventType
ITypeDefOrRefThe delegate type of the event.
Properties
AddMethod
Gets the method definition representing the first add accessor of this event definition.
public MethodDefinition? AddMethod { get; set; }
Property Value
Attributes
Gets or sets the attributes associated to the field.
public EventAttributes Attributes { get; set; }
Property Value
CustomAttributes
Gets a collection of custom attributes assigned to this member.
public IList<CustomAttribute> CustomAttributes { get; }
Property Value
DeclaringType
Gets the type that defines the property.
public TypeDefinition? DeclaringType { get; }
Property Value
EventType
Gets or sets the delegate type of the event.
public ITypeDefOrRef? EventType { get; set; }
Property Value
FireMethod
Gets the method definition representing the first fire accessor of this event definition.
public MethodDefinition? FireMethod { get; set; }
Property Value
FullName
Gets the full name of the object.
public string FullName { get; }
Property Value
IsRuntimeSpecialName
Gets or sets a value indicating the event uses a special name used by the runtime.
public bool IsRuntimeSpecialName { get; set; }
Property Value
IsSpecialName
Gets or sets a value indicating the event uses a special name.
public bool IsSpecialName { get; set; }
Property Value
Module
Gets the module that defines the member definition or reference.
public ModuleDefinition? Module { get; }
Property Value
Remarks
For member references, this does not obtain the module definition that the member is defined in. Rather, it obtains the module definition that references this reference.
Name
Gets or sets the name of the event.
public Utf8String? Name { get; set; }
Property Value
Remarks
This property corresponds to the Name column in the event table.
RemoveMethod
Gets the method definition representing the first remove accessor of this event definition.
public MethodDefinition? RemoveMethod { get; set; }
Property Value
Semantics
Gets a collection of methods that are associated with this member through special semantics.
public IList<MethodSemantics> Semantics { get; }
Property Value
Methods
GetCustomAttributes()
Obtains the list of custom attributes assigned to the member.
protected virtual IList<CustomAttribute> GetCustomAttributes()
Returns
- IList<CustomAttribute>
The attributes
Remarks
This method is called upon initialization of the CustomAttributes property.
GetDeclaringType()
Obtains the declaring type of the event definition.
protected virtual TypeDefinition? GetDeclaringType()
Returns
- TypeDefinition
The declaring type.
Remarks
This method is called upon initialization of the DeclaringType property.
GetEventType()
Obtains the event type of the event definition.
protected virtual ITypeDefOrRef? GetEventType()
Returns
- ITypeDefOrRef
The event type.
Remarks
This method is called upon initialization of the EventType property.
GetName()
Obtains the name of the event definition.
protected virtual Utf8String? GetName()
Returns
- Utf8String
The name.
Remarks
This method is called upon initialization of the Name property.
GetSemantics()
Obtains the methods associated to this event definition.
protected virtual IList<MethodSemantics> GetSemantics()
Returns
- IList<MethodSemantics>
The method semantic objects.
Remarks
This method is called upon initialization of the Semantics property.
IsAccessibleFromType(TypeDefinition)
Determines whether the member can be accessed from the scope that is determined by the provided type.
public bool IsAccessibleFromType(TypeDefinition type)
Parameters
type
TypeDefinitionThe type defining the scope.
Returns
- bool
True if the scope of the provided type can access the member, false otherwise.
IsImportedInModule(ModuleDefinition)
Determines whether the descriptor of the member is fully imported in the provided module.
public bool IsImportedInModule(ModuleDefinition module)
Parameters
module
ModuleDefinitionThe module that is supposed to import the member.
Returns
- bool
true
if the descriptor of the member is fully imported by the module,false
otherwise.
Remarks
This method verifies all references in the descriptor of the member only. It does not verify any additional data or contents (such as a method body) associated to the member.
SetSemanticMethods(MethodDefinition?, MethodDefinition?, MethodDefinition?)
Clear Semantics and apply these methods to the event definition.
public void SetSemanticMethods(MethodDefinition? addMethod, MethodDefinition? removeMethod, MethodDefinition? fireMethod)
Parameters
addMethod
MethodDefinitionThe method definition representing the add accessor of this event definition.
removeMethod
MethodDefinitionThe method definition representing the remove accessor of this event definition.
fireMethod
MethodDefinitionThe method definition representing the fire accessor of this event definition.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.