Marc

Marc

  • NA
  • 205
  • 53.8k

Property Modifier

Dec 12 2014 10:42 AM
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)