What does variable names beginning with _ mean?
There's no language-defined meaning - it's just a convention some people use to distinguish instance variables from local variables. Other variations include m_foo (and s_foo or g_foo or static variables) or mFoo; alternatively some people like to prefix the local variables (and parameters) instead of the instance variables.
Personally I don't use prefixes like this, but it's a style choice. So long as everyone working on the same project is consistent, it's usually not much of an issue. I've seen some horribly inconsistent code though...
The underscore before a variable name _val
is nothing more than a convention. In C#, it is used when defining the private member variable for a public property.
I'll add to what @Steven Robbins said:
private string _val;
public string Values
{
get { return _val;}
set {_val = value;}
}
In general, this means private member fields.