ImplementInterface(IAdviser<INamedType>, INamedType, OverrideStrategy, object?)
Makes a type implement a new interface specified as an INamedType. Interface members can be introduced declaratively by marking an aspect member with InterfaceMemberAttribute or IntroduceAttribute(IAdviser<IDeclaration>, IAttributeData, OverrideStrategy), or programmatically using introduction methods. Use the With<TNewDeclaration>(TNewDeclaration) method to implement the interface on a different type than the current one.
Declaration
public static IImplementInterfaceAdviceResult ImplementInterface(this IAdviser<INamedType> adviser, INamedType interfaceType, OverrideStrategy whenExists = OverrideStrategy.Default, object? tags = null)Parameters
| Type | Name | Description |
|---|---|---|
| IAdviser<INamedType> | adviser | An adviser for a named type. |
| INamedType | interfaceType | The type of the implemented interface. |
| OverrideStrategy | whenExists | Determines the implementation strategy when the interface is already implemented by the target type. The default strategy is to fail with a compile-time error. |
| object | tags | An optional object (typically of anonymous type) passed to InterfaceMemberAttribute templates and accessible via |
Returns
| Type | Description |
|---|---|
| IImplementInterfaceAdviceResult | An IImplementInterfaceAdviceResult exposing the implementation operation. |
See Also
ImplementInterface(IAdviser<INamedType>, Type, OverrideStrategy, object?)
Makes a type implement a new interface specified as a reflection Type. Interface members can be introduced declaratively by marking an aspect member with InterfaceMemberAttribute, IntroduceAttribute(IAdviser<IDeclaration>, IAttributeData, OverrideStrategy) or programmatically using introduction methods. Use the With<TNewDeclaration>(TNewDeclaration) method to implement the interface on a different type than the current one.
Declaration
public static IImplementInterfaceAdviceResult ImplementInterface(this IAdviser<INamedType> adviser, Type interfaceType, OverrideStrategy whenExists = OverrideStrategy.Default, object? tags = null)Parameters
| Type | Name | Description |
|---|---|---|
| IAdviser<INamedType> | adviser | An adviser for a named type. |
| Type | interfaceType | The type of the implemented interface. |
| OverrideStrategy | whenExists | Determines the implementation strategy when the interface is already implemented by the target type. The default strategy is to fail with a compile-time error. |
| object | tags | An optional object (typically of anonymous type) passed to InterfaceMemberAttribute templates and accessible via |
Returns
| Type | Description |
|---|---|
| IImplementInterfaceAdviceResult | An IImplementInterfaceAdviceResult exposing the implementation operation. |