开发者

Assigning Standard Names for Controls and datatypes

Using VB.Net and C#.Net.

For Example

Am Using More than one form

If am as开发者_Go百科signing a variables like this.

Dim a, b as integer Dim c, d as string

This variables cannot be easily understand for everyone(other programmers).

How to assign a Standard Datatype variables,

Standard Variable Means (Everyone can understandable)

And also How to give a standard name for gridview, text boxes, labels etc.


It looks like you are looking for some naming conventions. I've found this document a while back which pretty much describes the most common conventions: (pdf) http://www.icsharpcode.net/TechNotes/SharpDevelopCodingStyle03.pdf

I hope it helps!


Take a look at MSDN Naming Conventions or Design Guidelines.

To check if you stick to the rules you can use FxCop or StyleCop.


Please. OH please go in a bookstore, find "Clean Code" by Robert C. Martin. and browse the chapter on naming.

One of the comments in the book is how your code should be clear enough to abstract the types. For example, would anyone think that "user_name" is anything else but a string? Or if you need to know if "user_age" is an int or a float their is also something wrong, the code should abstract that.

Avoid prefixes. After a few weeks developers don't see them anymore. It quickly devolves to silly meaningless 2-3 letters that only makes the code harder to read. If you really need to know the type, today's development tool makes it real easy to find it, like hovering the mouse over a variable.

Use pronounceable words. This will easily make all variables easy to understand. Avoid things like usrdobisec (user date of birth in seconds)


Variable names in .net usually don't contain the type, since .Net is strongly typed, so this isn't really necessary.

Control names are sometimes prefixed with a type, for example lbl for a label.


I suggest you choose a variable naming convention and stick to it.

At the very least, give your variables meaningful names and not just a, b, c etc!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜