In “Framework Design Patterns”, under 5.1 “General Member Design Guidelines”, the following recommendation should be followed:
- DO NOT use default parameters, for any parameter type other than CancellationToken, on interface methods or virtual methods on classes.
This is inconsistent with how OnTopic is written. The recommended resolution is to instead implement the following:
Default parameters can be provided for interface methods via extension methods.
This relies on the method resolution logic of the C# compiler.
At minimum, this should be implemented on classes intended for dependency injection. For classes not intended for dependency injection, this may not be appropriate. See considerations below regarding using scope.
In “Framework Design Patterns”, under 5.1 “General Member Design Guidelines”, the following recommendation should be followed:
This is inconsistent with how OnTopic is written. The recommended resolution is to instead implement the following:
This relies on the method resolution logic of the C# compiler.
At minimum, this should be implemented on classes intended for dependency injection. For classes not intended for dependency injection, this may not be appropriate. See considerations below regarding
usingscope.