













①string ax=string.Empty;
注:不要使用: string ax=""; I don't konw why.But it's Microsoft's convention.
判断ax是否为空:
ax.Length==0 > ax==string.Empty
Info : "To test for empty strings, check if String.Length is
equal to zero. Constructs such as "".Equals(someString)
and String.Empty.Equals(someString) are less efficient
than testing the string length. Replace these with
checks for someString.Length == 0."
2007-7-13 13:51:10
②Catch{}要捕获详细异常,不要再乱抛
catch the specific exception than "System.Exception" or rethrow the exception.
Catching generic exception types can hide run-time problems from the library user,
and can complicate debugging.
③比较字符串时不要用.ToLower() / .ToUpper()
replace by Equals()
Don't create a string never used later.
【待续】
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。