In the contrived example below, which is the proper way to name my “[Nn]ame” property? It seems that everything in .NET is some form of Pascal case. Would it be considered “bad form” to use camel case for property names? I read the MS guidelines on naming, and they say to use Pascal
case. I really hate Pascal case and it seems like it is ALL that way.
What is the generally agreed upon standard (is it just the MS guide) or does it not matter? Am I bad if I use camel case here? TIA.
using System;
namespace Properties {
class Program {
static void Main() {
var tester = new Tester();
tester.Name = "jmquigley";
tester.name = "another jmquigley";
tester.Show();
}
}
class Employee {
public string Name { get; set; }
public string name { get; set; }
public void Show() {
Console.WriteLine("Name = {0}", Name);
Console.WriteLine("name = {0}", name);
}
}
class Tester : Employee {
}
}
NOTE: I only used inheritance here to see how a property was handled when using it (to see if everything worked just like a field).
Yes, the generally agreed-upon standard is the Microsoft guidelines.
Your code will run fine without following the guidelines, but I would follow the conventions if: