C# Field Naming Guidelines?

后端 未结 17 1276
天命终不由人
天命终不由人 2020-12-02 16:37

I am going to be working on a bit of C# code on my own but I want to make sure that I follow the most widely accepted naming conventions in case I want to bring on other dev

17条回答
  •  执笔经年
    2020-12-02 17:32

    I do this; it's pretty much in line with MSDN.

    class MyClass : MyBaseClass, IMyInterface
    {
        public event EventHandler MyEvent;
        int m_MyField = 1;
        int MyProperty {
            get {
                return m_MyField;
            }
            set {
                m_MyField = value;
            }
        }
    
        void MyMethod(int myParameter) {
            int _MyLocalVaraible = myParameter;
            MyProperty = _MyLocalVaraible;
            MyEvent(this, EventArgs.Empty);
        }
    }
    

    Here's a little more detail: http://jerrytech.blogspot.com/2009/09/simple-c-naming-convention.html

提交回复
热议问题