你在C#中使用什么命名约定? [英] What naming conventions do you use in C#?

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

问题描述

作为编程新手,我想定居在为自己标准的命名约定。我意识到这是个人喜好,但我想从一些你的一些想法(当然你很多)谁是比我聪明多了。

As a beginning programmer, I'm trying to settle on a standard naming convention for myself. I realize that it's personal preference, but I was trying to get some ideas from some of you (well a LOT of you) who are much smarter than myself.

我不是在谈论的骆驼符号,而是你如何命名变量等恕我直言,var_Quantity比Q或VARQ更多描述。但是,你怎么变得太长时间保持变量。我试着与我的命名控件的更多描述,但我已经结束了与一些像rtxtboxAddrLine1用于保存地址线1。太多我来说,这是无法管理一个RadTextBox,虽然很明显,控制是什么。

I'm not talking about camel notation but rather how do you name your variables, etc. IMHO, var_Quantity is much more descriptive than Q or varQ. However, how do you keep the variable from becoming too long. I've tried to be more descriptive with naming my controls, but I've ended up with some like "rtxtboxAddrLine1" for a RadTextBox that holds address line 1. Too me,that is unmanageable, although it's pretty clear what that control is.

我只是好奇,如果您有遵循还是我留给我自己的设备一些导游?

I'm just curious if you have some guides that you follow or am I left up to my own devices?

推荐答案

可以发现基本规则这里。和更多的扩展规则可以在这里找到。这是从Microsoft架构设计师的官方指南。

Some basic rules can be found here. And much more extended rules can be found here. These are the official guidelines from the Microsoft framework designers.

至于你的例子,变量是应被简称

As for your example, the variable should should be called simply quantity.

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

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