make it more obvious that this is about local functions#51170
make it more obvious that this is about local functions#51170AdmiralSnyder wants to merge 1 commit intodotnet:mainfrom
Conversation
... by sorrounding the fibonacci function/lambda with a proper method. ... also, unified spacing around operators
There was a problem hiding this comment.
Pull request overview
This PR improves the code examples for IDE0039 rule by wrapping the fibonacci function/lambda examples within proper method contexts to make it clearer that the rule is about local functions versus lambdas. The changes also unify spacing around operators for consistency.
Changes:
- Added enclosing
CalcFib5()method wrapper to both code examples - Unified operator spacing (consistent spaces around
-and+operators) - Added a
return fibonacci(5);call to demonstrate the usage - Added "vs." comment separator between the two examples
| ```csharp | ||
| // csharp_style_prefer_local_over_anonymous_function = true | ||
| int fibonacci(int n) | ||
| int CalcFib5() |
There was a problem hiding this comment.
The method name should use PascalCase according to .NET naming conventions. Consider renaming to "CalculateFib5" or "GetFibonacci5" to follow standard .NET naming conventions for public methods.
| Func<int, int> fibonacci = (int n) => | ||
| // vs. | ||
|
|
||
| int CalcFib5() |
There was a problem hiding this comment.
The method name should use PascalCase according to .NET naming conventions. Consider renaming to "CalculateFib5" or "GetFibonacci5" to follow standard .NET naming conventions for public methods.
... by sorrounding the fibonacci function/lambda with a proper method.
... also, unified spacing around operators
Summary
Describe your changes here.
Fixes #Issue_Number (if available)