Why does this code not work?
class Test
{
int Abc { private set; get; }
}
What is the default access modifier for properties?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The Abc property must be public, protected or internal:
In your case the property is private (because you haven’t specified an access modifier) so it’s already a private set. You cannot modify its value outside of the current class so it doesn’t really make sense to declare a private setter in this case.