C# virtual automatic properties omit get / set -


is ok omit or set in automatic property when declared virtual?

i referring book on c# shows members of system.exception follows :

  // properties public virtual idictionary data { get; } public virtual string helplink { get; set; } public exception innerexception { get; } public virtual string message { get; } public virtual string source { get; set; } public virtual string stacktrace { get; } public methodbase targetsite { get; }  

if automatic properties need have both , set, why ok here?

thanks.

this looks abbreviated signature properties, rather actual implementation.

i've not gone reflector, imagine above signature exception.data being implemented in 1 of 2 manners:

public virtual idictionary data {     { return _someinternalimplementation; } } 

or:

public virtual idictionary data {     { return _someinternalimplementation; }     private set { _someinternalimplementation = value; } } 

all implementor needs know may have public getter in override.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -