codeanalyzers icon indicating copy to clipboard operation
codeanalyzers copied to clipboard

Potential improvement of U2U1001

Open wmjordan opened this issue 1 year ago • 0 comments

Code snippet:

MethodConsumer.Consume(Implementation.Instance.Method);

sealed class Implementation {
  internal static Implementation Instance = new Instance();
  private Implementation() {}
  internal void Method() {
    // do something
  }
}

Class Implementation triggers U2U1001. However, if we make it a static class, MethodConsumer.Consume(Implementation.Instance.Method); will trigger another warning.

wmjordan avatar Aug 28 '23 01:08 wmjordan