Autoproperty error

Version 744
Code with compiler error:

public interface IElection
int Votes { get; set; }

public class Election : IElection
public int Votes { get; private set; }

The error is that the setter of the automatic property is marked private.

However, the "public" keyword is underlined with red to show the compiler error. (Wrong place, should be the "private".)

The Resharper correction says: "Make 'Votes.set' public". After executing, the code shows as:

public int Votes { get; public set; }

And the compiler error shows as: "The accessibility modifier of the 'Election.Votes.set' accessor must be more restrictive than the property or indexer 'Election.Votes'"

Removing the second "public" fixes the problem.



1 comment
Comment actions Permalink


We appreciate your feedback. The corresponding JIRA request has been created,
and you are welcome to monitor its status at

You may want to check our request tracking policy here:

Best regards,
- Development Team.


Please sign in to leave a comment.