learning auto-implemented properties
i have rudimentary category controlling auto-implemented properies:
public category foo
{
open foo() { }
open twine barname {get; set;}
}
i apparently non-static barname via category need supplement explanation ability value set (it contingency top case, figure). does meant i need emanate private non-static barname , e.g. _barname, change tide barname non-static used via category _barname?
public category foo
{
open foo() {}
private twine _barname = "";
open twine barname
{
{return _barname;}
set {_barname = value.tostring().toupper();}
}
}
i am perplexing certain i know implications controlling auto-implemented properties, entail down highway when/if i need change something. i am presumption refactoring, shown above, change since ability fundamentally staying same; only took small work inside category keep proceed supplement indispensable logic.
another example, competence some-more revealing i need slight setter getter used; some-more following changing value.
this seems satisfactory trade off the lines lines formula setup properties.
Comments
Post a Comment