C#中最常见的命名约定是什么? [英] What are the most common naming conventions in C#?

查看:91
本文介绍了C#中最常见的命名约定是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C#中,类,名称空间和方法最常用的命名约定是什么?在Java中使用getter/setter样式方法是否很常见?

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?

推荐答案

有一些常见的模式.我经常在自己的项目中看到和使用的一个是:

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()
        {
        }
    }
}

这篇关于C#中最常见的命名约定是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆