摘要: ToUpperInvariant使用不依赖于区域性进行转换,而ToUpper则使用了当前线程的CultureInfo,进行转换,所以性能会有所影响,以下为测试: 1 [Test] 2 public void TestInvariant() 3 { 4 Int32 count = 1000 * 1000; 5 Stopwatch watch = new Stopwatch(); 6 7 String str = "abcdefghijklmnopqrstuvwxyz中华人民共... 阅读全文
posted @ 2013-09-04 17:55 小R 阅读(480) 评论(0) 推荐(0) 编辑
摘要: 在编码时尽量使用ToUpper比较,避免使用ToLower,因为微软对ToUpper进行了优化,以下为测试结果: public void TestToLower() { Stopwatch watch = new Stopwatch(); Int32 count = 1000 * 1000; // ToUpper测试开始 String lowerStr = "abcdefghijklmnopqrstuvwxyz"; watch = Stopwatch.Sta... 阅读全文
posted @ 2013-09-04 17:52 小R 阅读(369) 评论(0) 推荐(0) 编辑