diff --git a/docs/fundamentals/code-analysis/quality-rules/ca2256.md b/docs/fundamentals/code-analysis/quality-rules/ca2256.md index 141b1597ee659..d6b2ec326839a 100644 --- a/docs/fundamentals/code-analysis/quality-rules/ca2256.md +++ b/docs/fundamentals/code-analysis/quality-rules/ca2256.md @@ -9,6 +9,8 @@ helpviewer_keywords: - DynamicInterfaceCastableImplementationAnalyzer - CA2256 author: Youssef1313 +dev_langs: +- CSharp --- # CA2256: All members declared in parent interfaces must have an implementation in a DynamicInterfaceCastableImplementation-attributed interface @@ -32,6 +34,10 @@ Types attributed with + interface IParent + { + void ParentMethod(); + } + + // This interface violates the rule. + [DynamicInterfaceCastableImplementation] + interface IBadChild : IParent + { + static void ChildMethod() + { + // ... + } + } + + // This interface satisfies the rule. + [DynamicInterfaceCastableImplementation] + interface IGoodChild : IParent + { + static void ChildMethod() + { + // ... + } + + void IParent.ParentMethod() + { + // ... + } + } + // +}