Pascal大小写或骆驼套管的C#code? [英] Pascal casing or Camel Casing for C# code?

查看:562
本文介绍了Pascal大小写或骆驼套管的C#code?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直吵着我的同事约Pascal大小写(大写驼峰)与低驼峰规则。它们被用来降低驼色外套一切从SQL数据库中的表名,属性命名在C#code,但我喜欢Pascal大小写更好,更低的驼色外套变量和Pascal大小写属性:

I've been arguing with my coworkers about Pascal casing (upper camel case) vs. lower CamelCasing. They are used to lower camel casing for everything from table names in SQL databases to property naming in C# code but I like Pascal casing better, lower camel casing for variables and Pascal casing for properties:

string firstName;
public string FirstName {
...
}

但它们用于这样的:

But they are used to this:

string _firstname;
public string firstName {
...
}

我试着跟上他们的标准,因此code看起来是一样的,但我只是不喜欢它。

I try to keep up with their "standard" so the code looks the same but I just don't like it.

我已经看到了,至少在.NET框架使用这个约定,那就是我如何努力让我的code,例如:

I've seen that at least the .NET framework uses this convention and that is how I try to keep my code, e.g.:

System.Console.WriteLine("string")

你用什么/ preFER,为什么?我很抱歉,如果别人问过这个问题,但我搜查,并没有发现任何东西。

What do you use/prefer and why? I'm sorry if somebody else asked this question but I searched and did not find anything.

更新: 我给的方法的例子,而不是一个属性,但它是相同的。正如我在第一段所说的我的同事们使用的Pascal约定的一切(变量,方法,表名,等。)

Update: I've given a method example and not a property but it's the same. As I stated in the first paragraph my colleagues use the Pascal convention for everything (variables, methods, table names, etc.)

推荐答案

我使用的框架使用,因为它是事实上的最佳实践。但是,只要code。在贵公司的一致用自己的风格,那么你就好得多习惯了。如果每个开发人员都有自己的标准,那么就没有标准可言。

I use what the Framework uses, as it's the de-facto best practice. However, so long as the code in your company is consistently using their style, then you're much better off getting used to it. If every developer has their own standard, then there's no standard at all.

这篇关于Pascal大小写或骆驼套管的C#code?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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