What are the coding habits that .NET programmers have to follow
In view of the coding habits that .NET programmers have to follow, this article introduces in detail the corresponding analysis and answers, hoping to help more partners who want to solve this problem to find a simpler and easier way.
The editor will introduce you to 20 .NET coding habits that .NET programmers have to follow.
1. Instead of hardcoding string/ numeric, you can use some constants instead. (improve readability)
Int Count; Count = 100; private static const int ZERO = 0; if (Count = = ZERO) {/ / perform some actions}
2. For string comparison-use String. Empty, not "".
3. Do not declare member variables as public or proteted, try to use private member variables and public/protected attributes. (modify)
4. When we want to manipulate a string in a loop and use StringBuilder instead of a string, the example is as follows.
Bad habits:
String temp = String.Empty; for (int I = 0; I