Monday, March 30, 2015

Is it possible to have different access modifiers on the get/set methods of a property?

Question:Is it possible to have different access modifiers on the get/set methods of a property??

Answer: </P><P align=justify>No. The access modifier on a property applies to both its get and set accessors. What you need to do if you want them to be different is make the property read-only (by only providing a get accessor) and create a private/internal set method that is separate from the property.

Tags:Interview Questions, Microsoft, C#,

Please submit your Interview Answer for the above Question via replying to this post. Thank you for visiting to our blog, Have a Good Day!.



Sponsor Advertisement



Library Automation Software

Library Management System Software

Our Library Management Softare offers complete library management modules and automation solution that enables information providers, information managers, resource incharge, resource managers & librarians to manage & disseminate information & resources....

No comments:

Post a Comment