C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Note: Value is a special variable that is automatically set. It is a contextual keyword.
ValueExample that shows property: C#
class SitePage
{
string _specialString;
public string SpecialString
{
get { return _specialString; }
set { _specialString = value; }
}
}
Then: Create or go to a private string member field. Members are private by default.
Next: Right-click your mouse on the string member name. Your context menu will appear. Hover your mouse over Refactor > Encapsulate Field.
Finally: Visual Studio inserts the property getter and setter. The result will look like the example on this document.
Example that shows property usage: C#
SitePage superObject = new SuperObject();
superObject.SpecialString = "Cool";