ReSharper
 
Get ReSharper
Get your hands on the new features ahead of the release by joining the Early Access Program for ReSharper 2025.1! Learn more

Code inspection: Local function can be made static

Last modified: 11 February 2024

Static local functions are designed to be independent of the state of the enclosing scope. Therefore, if ReSharper detects a local function that does not use any variables from the enclosing scope, it suggests making such function static.

This way ReSharper infers the intended use of the function and makes sure that this intent is clearly visible to those who will read or modify the code later.