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; }
}
{
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.
Glen
Please sign in to leave a comment.
Hello,
We appreciate your feedback. The corresponding JIRA request has been created,
and you are welcome to monitor its status at http://www.jetbrains.net/jira/browse/RSRP-60142.
You may want to check our request tracking policy here: http://www.jetbrains.net/confluence/display/ReSharper/ReSharperIssueTracker
Best regards,
- Development Team.