Samir Bhogayta
IS it possible to have different access modifiers on the get/set methods of a property?
By Samir Bhogayta in C# on Jun 25 2016
  • Tushar Dikshit
    Oct, 2017 30

    Yes. Please refer ---------------------------------- https://stackoverflow.com/questions/4746670/can-separate-access-modifiers-be-specified-for-the-get-and-set-accessors-of-a-prhttps://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/restricting-accessor-accessibility

    • 0
  • Samir Bhogayta
    Jun, 2016 25

    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.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS