Class TypeDefinitionExtenions
Extension methods for
Inheritance
Namespace: Cortex.Net.Fody
Assembly: Cortex.Net.Fody.dll
Syntax
public static class TypeDefinitionExtenions : object
Methods
| Improve this Doc View SourceCreateBackingField(TypeDefinition, TypeReference, String, WeavingContext)
Creates a backing field for a property.
Declaration
public static FieldDefinition CreateBackingField(this TypeDefinition classType, TypeReference fieldType, string name, WeavingContext weavingContext)
Parameters
| Type | Name | Description |
|---|---|---|
| TypeDefinition | classType | The type reference of the class. |
| TypeReference | fieldType | The type reference of the Field. |
| System.String | name | The name of the Property. |
| WeavingContext | weavingContext | The weaving context. |
Returns
| Type | Description |
|---|---|
| FieldDefinition | The Field definition. It has already been added to the class type. |
CreateDefaultGetter(TypeDefinition, FieldDefinition, String, WeavingContext, MethodAttributes)
Creates a default getter for a property.
Declaration
public static MethodDefinition CreateDefaultGetter(this TypeDefinition classType, FieldDefinition backingField, string name, WeavingContext weavingContext, MethodAttributes methodAttributes = null)
Parameters
| Type | Name | Description |
|---|---|---|
| TypeDefinition | classType | The type reference of the class. |
| FieldDefinition | backingField | A reference to the backing field. |
| System.String | name | The name of the property. |
| WeavingContext | weavingContext | The type of the weavingContext. |
| MethodAttributes | methodAttributes | The methodAttributes for this getter. Default value is MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.SpecialName. |
Returns
| Type | Description |
|---|---|
| MethodDefinition | A method definition. The method is already added to the |
CreateDefaultSetter(TypeDefinition, FieldDefinition, String, WeavingContext, MethodAttributes, Action<ILProcessor>)
Creates a default getter for a property.
Declaration
public static MethodDefinition CreateDefaultSetter(this TypeDefinition classType, FieldDefinition backingField, string name, WeavingContext weavingContext, MethodAttributes methodAttributes = null, Action<ILProcessor> emitAction = null)
Parameters
| Type | Name | Description |
|---|---|---|
| TypeDefinition | classType | The type reference of the class. |
| FieldDefinition | backingField | A reference to the backing field. |
| System.String | name | The name of the property. |
| WeavingContext | weavingContext | The weaving context. |
| MethodAttributes | methodAttributes | The methodAttributes for this getter. Default value is MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.SpecialName. |
| Action<ILProcessor> | emitAction | Extra emit action after default setter. |
Returns
| Type | Description |
|---|---|
| MethodDefinition | A method definition. The method is already added to the |
CreateField(TypeDefinition, TypeReference, String, WeavingContext, FieldAttributes)
Creates a field.
Declaration
public static FieldDefinition CreateField(this TypeDefinition classType, TypeReference fieldType, string name, WeavingContext weavingContext, FieldAttributes fieldAttributes = null)
Parameters
| Type | Name | Description |
|---|---|---|
| TypeDefinition | classType | The type reference of the class. |
| TypeReference | fieldType | The type reference of the Field. |
| System.String | name | The name of the field. |
| WeavingContext | weavingContext | The weaving context. |
| FieldAttributes | fieldAttributes | The field Atrributes. |
Returns
| Type | Description |
|---|---|
| FieldDefinition | The Field definition. It has already been added to the class type. |
CreateProperty(TypeDefinition, String, MethodDefinition, MethodDefinition)
Creates a property using the specified getter / setter.
Declaration
public static PropertyDefinition CreateProperty(this TypeDefinition classType, string name, MethodDefinition getter, MethodDefinition setter = null)
Parameters
| Type | Name | Description |
|---|---|---|
| TypeDefinition | classType | The type of the class to create the property on. |
| System.String | name | The name of the property. |
| MethodDefinition | getter | The getter for the property. |
| MethodDefinition | setter | The setter for the property. Can be null. |
Returns
| Type | Description |
|---|---|
| PropertyDefinition | The created property definitition. |
IsReplaceableCollection(TypeReference, WeavingContext)
Returns whether the type reference is of a type that can be replaced by ObservableCollection{T}.
Declaration
public static bool IsReplaceableCollection(this TypeReference typeReference, WeavingContext weavingContext)
Parameters
| Type | Name | Description |
|---|---|---|
| TypeReference | typeReference | The typeReference to check. |
| WeavingContext | weavingContext | The weavingContext to use.. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True when the type is a type that can be replaced by one of the interfaces of ObservableCollection{T}", false otherwise. |