It's usually to see a
_var variable name in a class field. What does the underscore mean? Thanks
_var variable name in a class field. What does the underscore mean? Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
VulpesRank #55 · 29.2K reputationPosted Jul 5, 2014, 5:32 AM EDT
private string _name;
public string Name
{
get { return _name;}
set { _name = value; }
}
This is just a convention and you don't have to follow it if you're allergic to underscores.
One thing you shouldn't do is to precede your identifiers with a double underscore as this is reserved for use by the system. For example __arglist is an undocumented C# keyword which is used for calling C functions which take a variable number of arguments.
Himanshu Pandya60 reputationPosted Jul 6, 2014, 10:11 PM EDT
Mahesh ChandRank #1 · 393.4K reputationPosted Jul 5, 2014, 4:47 AM EDT