Class PropertyDefinition
- Namespace
- AsmResolver.DotNet
- Assembly
- AsmResolver.DotNet.dll
Represents a single property in a type definition of a .NET module.
public class PropertyDefinition : MetadataMember, IHasSemantics, IMemberDefinition, IMemberDescriptor, IFullNameProvider, IImportable, IHasCustomAttribute, IHasConstant, IMetadataMember, INameProvider, IModuleProvider, IOwnedCollectionElement<TypeDefinition>
- Inheritance
-
PropertyDefinition
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
PropertyDefinition(MetadataToken)
Initializes a new property definition.
protected PropertyDefinition(MetadataToken token)
Parameters
token
MetadataTokenThe token of the property.
PropertyDefinition(Utf8String?, PropertyAttributes, PropertySignature?)
Creates a new property definition.
public PropertyDefinition(Utf8String? name, PropertyAttributes attributes, PropertySignature? signature)
Parameters
name
Utf8StringThe name of the property.
attributes
PropertyAttributesThe attributes.
signature
PropertySignatureThe signature of the property.
Properties
Attributes
Gets or sets the attributes associated to the field.
public PropertyAttributes Attributes { get; set; }
Property Value
Constant
Gets or sets a constant that is assigned to the member.
public Constant? Constant { get; set; }
Property Value
Remarks
If this property is set to null
, the member is not assigned a constant value.
Updating this property does not update any of the attributes associated to the member.
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
FullName
Gets the full name of the object.
public string FullName { get; }
Property Value
GetMethod
Gets the method definition representing the first get accessor of this property definition.
public MethodDefinition? GetMethod { get; set; }
Property Value
HasDefault
Gets or sets a value indicating the property has a default value.
public bool HasDefault { get; set; }
Property Value
IsRuntimeSpecialName
Gets or sets a value indicating the property uses a special name used by the runtime.
public bool IsRuntimeSpecialName { get; set; }
Property Value
IsSpecialName
Gets or sets a value indicating the property 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 property.
public Utf8String? Name { get; set; }
Property Value
Remarks
This property corresponds to the Name column in the property definition table.
Semantics
Gets a collection of methods that are associated with this member through special semantics.
public IList<MethodSemantics> Semantics { get; }
Property Value
SetMethod
Gets the method definition representing the first set accessor of this property definition.
public MethodDefinition? SetMethod { get; set; }
Property Value
Signature
Gets or sets the signature of the property. This includes the property type, as well as any parameters the property might define.
public PropertySignature? Signature { get; set; }
Property Value
Methods
GetConstant()
Obtains the constant value assigned to the property definition.
protected virtual Constant? GetConstant()
Returns
- Constant
The constant.
Remarks
This method is called upon initialization of the Constant property.
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 property definition.
protected virtual TypeDefinition? GetDeclaringType()
Returns
- TypeDefinition
The declaring type.
Remarks
This method is called upon initialization of the DeclaringType property.
GetName()
Obtains the name of the property 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 property definition.
protected virtual IList<MethodSemantics> GetSemantics()
Returns
- IList<MethodSemantics>
The method semantic objects.
Remarks
This method is called upon initialization of the Semantics property.
GetSignature()
Obtains the signature of the property definition.
protected virtual PropertySignature? GetSignature()
Returns
- PropertySignature
The signature.
Remarks
This method is called upon initialization of the Signature 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?)
Clear Semantics and apply these methods to the property definition.
public void SetSemanticMethods(MethodDefinition? getMethod, MethodDefinition? setMethod)
Parameters
getMethod
MethodDefinitionThe method definition representing the get accessor of this property definition.
setMethod
MethodDefinitionThe method definition representing the set accessor of this property definition.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.