最新评论

re: 实在不想离开C# qrh 2007-11-28 16:16  
楼主 紫光面试会问些什么啊 ?我笔试通过了 这周五去面试
re: 实在不想离开C# eyuyr 2007-04-09 13:54  
后天就要去紫光华宇面试了,好紧张,也不知道面试能pass吗?
re: 实在不想离开C# perfect 2007-03-06 21:07  
你们都是前辈都是过来人啊,我还不知道笔试是做些什么呢?
明天才去参加笔试.真有点担心.
希望我也是个幸运儿!!
re: 实在不想离开C# mihua 2006-12-15 20:51  
看了你的文章,想 哭,紫光华宇笔试过了,可面试没有,
re: 最近真郁闷!! 王答 2004-03-27 16:02  
可不就这个样吗?都烦死了。
re: 最近真郁闷!! Meyer 2004-03-25 13:49  
怎么还跟初中一样?
re: Effective C#-Working with Strings 王答 2004-03-24 18:30  
多谢birdshome指点!!
re: Effective C#-Working with Strings birdshome 2004-03-23 22:45  
第一条为了适应更多情况应该这样写:

string str;

...

if ( str != null && str.Length > 0 )
{
...
}
// 顺序很重要,反了就ft了。

第二条不是那儿都需要,毕竟

StringBuilder strb = new StringBuilder();
strb.Append("string a");
strb.Append("string b");
string strNew = strb.ToString();

比 string strNew = "string a" + "string b";

麻烦太多了,使用 StringBuilder 主要是在循环里面,

就是说要反复的生成很多的 string 的时候,我们才使用

StringBuilder。还有就是字符串很长的时候,比如 string 都好几百K了,

就是就是很少的 + op,也很消耗资源。

第三条不需要,在 CLI 里,== 运算就是用 Equals 实现的,

public static bool operator == (String a, String b)
{
return String.Equals(a, b);
}

re: Effective C#-Working with Strings 王答 2004-03-22 15:55  
谢谢Meyer指教,我就喜欢指出我不会的东东。

to:mice90
这不是一本书的一个章节,是我从CSDN上看到的,觉得挺好,就给译了过来,放到这里啦。
re: Effective C#-Working with Strings nice90 2004-03-22 14:30  
请问一下你的<Effective C#>书在哪儿有呢?谢谢!
mail to :nice90 at 163 dot com
re: Effective C#-Working with Strings Meyer 2004-03-22 08:53  
string的空有两种情况
null & string.Empty
对于第二种,str1.Length>0 已经足够
对于第一种 str1.Length>0 肯定会引发
NullReferenceException
如果不能确信还是使用
(str != null && str.Length != 0)
re: 总想Blog一把,今天上网,遇到注册一个了。 cowboy(chenzizhao@hotmail.com) 2004-02-05 13:56  
希望你有精彩内容show出来。