The proposal is to declare a local function as non-capturing. The keyword to indicate that would be static.
Note: if we do this, then we should also consider allowing parameters and locals of the local function to shadow parameters and locals from the containing method.
The proposal is to declare a local function as non-capturing. The keyword to indicate that would be
static
.Note: if we do this, then we should also consider allowing parameters and locals of the local function to shadow parameters and locals from the containing method.
Related discussion thread, including a discussion of "capture lists" (a more elaborate feature): https://github.com/dotnet/csharplang/issues/1277
Note: EE scenarios are a concern.
Do we want to allow some other modifiers (like
unsafe
)?LDM history: