Roslyn: Keyword recommender doesn't know about struct's readonly members

Created on 14 Oct 2019  路  5Comments  路  Source: dotnet/roslyn

Version Used:
VS 16.3.4

struct S
{
    readonly $$
}

No void keyword here. A readonly void method could still modify global state using the value of instance state, so still meaningful.


struct S
{
    public $$ int X() => 1;
}

readonly presents here.


struct S
{
    public int X
    {
        $$ get => 1;
    }
}

No readonly here.


struct S
{
    public int X
    {
        $$
    }
}

No readonly here.


struct S
{
    public int X
    {
        readonly $$
    }
}

Recommending types instead of accessor keywords.

Area-IDE Bug IDE-IntelliSense help wanted

All 5 comments

@dotnet/roslyn-compiler can you verify all of these locations so we can get them implemented?

@RikkiGibson

can you verify all of these locations so we can get them implemented?

All of the locations mentioned by @huoyaoyuan look like valid places to recommend the keyword to me.

And there may be some clearification for readonly ref readonly. Quite confusing for ones haven't read changelog.

Was this page helpful?
0 / 5 - 0 ratings