AdviserExtensions.OverrideAccessors Method
OverrideAccessors(IAdviser<IFieldOrPropertyOrIndexer>, in GetterTemplateSelector, string?, object?, object?)
Overrides a field or property by specifying a method template for the getter, the setter, or both. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another declaration than the current one.
Declaration
public static IOverrideAdviceResult<IPropertyOrIndexer> OverrideAccessors(this IAdviser<IFieldOrPropertyOrIndexer> adviser, in GetterTemplateSelector getTemplate = default, string? setTemplate = null, object? args = null, object? tags = null)
Parameters
Type | Name | Description |
---|---|---|
IAdviser<IFieldOrPropertyOrIndexer> | adviser | An adviser for a field, or a property or an indexer. |
GetterTemplateSelector | getTemplate | The name of the method of the aspect class whose implementation will be used as a template for the getter, or |
string | setTemplate | The name of the method of the aspect class whose implementation will be used as a template for the getter, or |
object | args | An object (typically of anonymous type) whose properties map to parameters or type parameters of the template methods. |
object | tags | An optional opaque object of anonymous type passed to the template method and exposed under the Tags property of the meta API. |
Returns
Type | Description |
---|---|
IOverrideAdviceResult<IPropertyOrIndexer> |
See Also
OverrideAccessors(IAdviser<IFieldOrProperty>, in GetterTemplateSelector, string?, object?, object?)
Declaration
public static IOverrideAdviceResult<IProperty> OverrideAccessors(this IAdviser<IFieldOrProperty> adviser, in GetterTemplateSelector getTemplate = default, string? setTemplate = null, object? args = null, object? tags = null)
Parameters
Type | Name | Description |
---|---|---|
IAdviser<IFieldOrProperty> | adviser | |
GetterTemplateSelector | getTemplate | |
string | setTemplate | |
object | args | |
object | tags |
Returns
Type | Description |
---|---|
IOverrideAdviceResult<IProperty> |
OverrideAccessors(IAdviser<IIndexer>, in GetterTemplateSelector, string?, object?, object?)
Declaration
public static IOverrideAdviceResult<IIndexer> OverrideAccessors(this IAdviser<IIndexer> adviser, in GetterTemplateSelector getTemplate = default, string? setTemplate = null, object? args = null, object? tags = null)
Parameters
Type | Name | Description |
---|---|---|
IAdviser<IIndexer> | adviser | |
GetterTemplateSelector | getTemplate | |
string | setTemplate | |
object | args | |
object | tags |
Returns
Type | Description |
---|---|
IOverrideAdviceResult<IIndexer> |
OverrideAccessors(IAdviser<IEvent>, string?, string?, string?, object?, object?)
Overrides an event by specifying a template for the adder, the remover, and/or the raiser. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another declaration than the current one.
Declaration
public static IOverrideAdviceResult<IEvent> OverrideAccessors(this IAdviser<IEvent> adviser, string? addTemplate, string? removeTemplate, string? raiseTemplate = null, object? args = null, object? tags = null)
Parameters
Type | Name | Description |
---|---|---|
IAdviser<IEvent> | adviser | An adviser for an event. |
string | addTemplate | The name of the method of the aspect class whose type and implementation will be used as a template for the adder, or |
string | removeTemplate | The name of the method of the aspect class whose type and implementation will be used as a template for the remover, or |
string | raiseTemplate | Not yet implemented. |
object | args | An object (typically of anonymous type) whose properties map to parameters or type parameters of the template methods. |
object | tags | An optional opaque object of anonymous type passed to the template method and exposed under the Tags property of the meta API. |
Returns
Type | Description |
---|---|
IOverrideAdviceResult<IEvent> |