.NET(C#)代码性能优化_AX
2007-06-29 11:36
393 查看
①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.
【待续】
博客园→斧头帮少帮主
注:不要使用: 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.
【待续】
博客园→斧头帮少帮主
相关文章推荐
- .NET(C#)代码性能优化
- .NET(C#)代码性能优化
- C# 代码优化 性能优化【转】
- C#、.Net代码精简优化(空操作符(??)、as、string.IsNullOrEmpty() 、 string.IsNullOrWhiteSpace()、string.Equals()、System.IO.Path 的用法)
- C#性能优化实践
- 盘点.NET的性能优化策略(转)
- 35 个 Java 代码性能优化总结
- C#提升性能"数据库连接打开与关闭"经验分享(附:优化过的DBHelper类) 之配餐系统的开发
- C#代码优化学习总结(3)
- java代码性能优化
- .net代码之c#连连看核心代码研究
- 不修改代码就能优化ASP.NET网站性能的一些方法
- 【Android性能优化】Android-Lint:查错与代码优化利器
- asp.net程序性能优化的七个方面 (c#(或vb.net)程序改进)
- Java 代码性能优化
- 不得不看的Java代码性能优化总结
- 不修改代码就能优化ASP.NET网站性能的一些方法
- js 性能优化——代码片段
- .NET(C#):使用Win32Exception类型处理Win32错误代码
- java代码优化性能总结