What are the most common naming conventions in C#?

后端 未结 6 525
我寻月下人不归
我寻月下人不归 2021-01-06 22:52

What are the most common naming conventions in C# for classes, namespaces and methods? Is it common to have getter/setter style methods as in Java?

6条回答
  •  再見小時候
    2021-01-06 23:28

    There are a few common patterns out there. One I frequently see and use in my own projects is:

    namespace Company.Concept.SubConcept
    {
        public class MyClass
        {
            private MyType someData;
    
            public MyType SomeData
            { 
                get { return someData; }
                set { someData = value; }
            }
    
            public void MyMethod()
            {
            }
        }
    }
    

提交回复
热议问题