Skip to content

Completion should preselect IEnumerable properties in foreach #33427

@333fred

Description

@333fred

As an example, look at the following class definition:

using System.Collections.Generic;
public class C
{
    public object Prop { get; set; }
    public IEnumerable<int> PropWithEnumerable { get; set; }
}

When typing foreach (var x in c.|cursor here|, we should preselect the PropWithEnumerable. We can do this for variable assignment (ie IEnumerable<int> x = c.|cursor here|), so this should be just extending the case to foreach enumerations. As an added bonus it would be great if it was smart about an explicitly typed enumerator variable, so if I had an IEnumerable<int> and an IEnumerable<string> property and had explicitly specified the foreach variable to be a string it would select the correct property.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-IDEIDE-IntelliSenseCompletion, Signature Help, Quick Infohelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on it

    Projects

    Status

    Complete

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions