Skip to content

Umbrella: Leftovers for local functions #92

@bkoelman

Description

@bkoelman

Similar to methods, local functions should probably be constrained in their maximum number of parameters (AV1561) and maximum number of statements (AV1500). Tracked by #140.

Likewise, mentions in other rules may need to be expanded to include local functions. In most cases, it should be sufficient to replace "methods" or "members" with: "methods/members and local functions".

Additionally, we may want to provide guidance on when to (not) use local functions:

Discussed in #96 (comment):

public IEnumerable<T> Enumerate<T>(IEnumerable<T> items)
{
    if (items == null)
    {
        throw new ArgumentException(nameof(items));
    }

    return InnerEnumerate(items);

    IEnumerable<T> InnerEnumerate(IEnumerable<T> array)
    {
        foreach (var item in array)
        {
            yield return item;
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions