The first thing you need to understand is what happens when you have an automatic property:
public virtual string English { get; set; }
Behind the scenes, the compiler creates a private field and gets / sets this private field when accessing the property. It is equivalent to this
private string _english;
public virtual string English { get { return _english; } set { _english = value; } }
except that you do not know the name of the private field, and therefore you cannot access it.
, TranslationStyleA , .
public override string English
{
get { return base.English; }
set { base.English = value; }
}
TranslationStyleB ( ). , English , , :
private string english;
public override string English
{
get { return english; }
set { english = value; }
}
, , , , . , , , .
, . , , .
public override string English
{
get { return base.English; }
set { base.English = value.Trim(); }
}
, - . , :
public String Foo;
public String Foo { get; set; } // <-- why bother with all this extra { get; set; } stuff?
, . ,
public String Foo;
public String Foo { get; set; }
, . ,
public String Foo { get; set; }
to
private string _foo;
public String Foo { get { return _foo; } set { _foo = value.Trim(); } }
( ).
(Translation) English, :
private string _english;
public String English { get { return _english; } set { _english = value.ToUpper(); } }
!
, , , , , .