7
Answers

Property Modifier

Marc

Marc

9y
736
1
I have a property with read/write capability. This particular property points to the log file.  What I wanted to know is what is the best modifier to attach to my property "set," so that no one can modify it? 
 
Example:
 
public static string writeToFile { get; internal set; }
 
or
 
public static string writeToFile { get; protected set; }
 
Is one of these better than the other? Or is there a better way to protect set?
Answers (7)