Let\'s say, we have a variable, which we want named Fubar
Let\'s say that Fubar
is a String
!
That means, we would define F
I see a ton of outdated answers (and non-standard ways representing C#6), so this one's for 2020:
// "fubar" works, too, but "_" prevents CaSe typo mistakes
private string _fubar;
public string Fubar
{
get => _fubar;
set => _fubar = value;
}
// Read-only can just use lambda to skip all those shenannigans
public string ReadOnlyFoo => "This is read-only!";