Skip to content
Discussion options

You must be logged in to vote

You can implement that interface while having SetProp, by using an explicit backing field:

class A : IA
{
    private int prop;
    
    public void SetProp(int value) => prop = value;
    
    public int Prop { get => prop; init => prop = value; }
}

Though I agree it would be nice if you didn't have to do that.

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@liamlim
Comment options

@svick
Comment options

svick Oct 18, 2020
Collaborator

Comment options

You must be logged in to vote
1 reply
@YairHalberstadt
Comment options

Answer selected by liamlim
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants