diff --git a/docs/csharp/advanced-topics/interface-implementation/media/mixins-with-default-interface-methods/diamond-problem.png b/docs/csharp/advanced-topics/interface-implementation/media/mixins-with-default-interface-methods/diamond-problem.png new file mode 100644 index 0000000000000..f4f192b051cc5 Binary files /dev/null and b/docs/csharp/advanced-topics/interface-implementation/media/mixins-with-default-interface-methods/diamond-problem.png differ diff --git a/docs/csharp/advanced-topics/interface-implementation/media/mixins-with-default-interface-methods/diamond-problem.svg b/docs/csharp/advanced-topics/interface-implementation/media/mixins-with-default-interface-methods/diamond-problem.svg deleted file mode 100644 index 02fceb3493b0f..0000000000000 --- a/docs/csharp/advanced-topics/interface-implementation/media/mixins-with-default-interface-methods/diamond-problem.svg +++ /dev/null @@ -1 +0,0 @@ -
« interface »
ILight
PowerStatus
« interface »
IBlinkingLight
PowerStatus
« interface »
ITimerLight
PowerStatus
OverheadLight
\ No newline at end of file diff --git a/docs/csharp/advanced-topics/interface-implementation/mixins-with-default-interface-methods.md b/docs/csharp/advanced-topics/interface-implementation/mixins-with-default-interface-methods.md index e1dded0371fd0..e420e3dc527e4 100644 --- a/docs/csharp/advanced-topics/interface-implementation/mixins-with-default-interface-methods.md +++ b/docs/csharp/advanced-topics/interface-implementation/mixins-with-default-interface-methods.md @@ -116,11 +116,11 @@ The default implementation assumes no power: These changes compile cleanly, even though the `ExtraFancyLight` declares support for the `ILight` interface and both derived interfaces, `ITimerLight` and `IBlinkingLight`. There's only one "closest" implementation declared in the `ILight` interface. Any class that declared an override would become the one "closest" implementation. You saw examples in the preceding classes that overrode the members of other derived interfaces. -Avoid overriding the same method in multiple derived interfaces. Doing so creates an ambiguous method call whenever a class implements both derived interfaces. The compiler can't pick a single better method so it issues an error. For example, if both the `IBlinkingLight` and `ITimerLight` implemented an override of `PowerStatus`, the `OverheadLight` would need to provide a more specific override. Otherwise, the compiler can't pick between the implementations in the two derived interfaces. This situation is shown in the following diagram: +Avoid overriding the same method in multiple derived interfaces. Doing so creates an ambiguous method call whenever a class implements both derived interfaces. The compiler can't pick a single better method so it issues an error. For example, if both the `IBlinkingLight` and `ITimerLight` implemented an override of `Power()`, the `OverheadLight` would need to provide a more specific override. Otherwise, the compiler can't pick between the implementations in the two derived interfaces. This situation is shown in the following diagram: -:::image type="content" source="./media/mixins-with-default-interface-methods/diamond-problem.svg" alt-text="illustration of the diamond problem with default interface methods"::: +:::image type="content" source="./media/mixins-with-default-interface-methods/diamond-problem.png" alt-text="illustration of the diamond problem with default interface methods"::: -The preceding diagram illustrates the ambiguity. `OverheadLight` doesn't provide an implementation of `ILight.PowerStatus`. Both `IBlinkingLight` and `ITimerLight` provide overrides that are more specific. A call to `ILight.PowerStatus` on an instance of `OverheadLight` is ambiguous. You must add a new override in `OverheadLight` to resolve the ambiguity. +The preceding diagram illustrates the ambiguity. `OverheadLight` doesn't provide an implementation of `ILight.Power()`. Both `IBlinkingLight` and `ITimerLight` provide overrides that are more specific. A call to `ILight.Power()` on an instance of `OverheadLight` is ambiguous. You must add a new override in `OverheadLight` to resolve the ambiguity. You can usually avoid this situation by keeping interface definitions small and focused on one feature. In this scenario, each capability of a light is its own interface; only classes inherit multiple interfaces.