Skip to content

Incorrect INPC021 when using setter method #164

Open
@jnm2

Description

@jnm2
class C : ViewModel
{
    private string? p;

    public string? P
    {
        get => p;
        /* INPC021 Setter should set backing field.
        ↓ */
        set => SetP(value);
    }

    private void SetP(string? value)
    {
        Set(ref p, value, nameof(P));
    }
}

The motivation of using such a method is to give it a second parameter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions