有以下几种办法:
1、VS2005 用 Ctrl+E+D
2、VS2008 用 Ctrl+K+D
3、删除最后一个花括号,重新打上
4、Ctrl+A(全选) --> Ctrl+X(剪切) -->Ctrl+V(再粘回来)
5、选中代码(不含注释行),点取消注释。
string与stream互转
string str = "This is string.";
byte[] array = Encoding.ASCII.GetBytes(str);
MemoryStream stream = new MemoryStream(array); //convert string 2 stream
StreamReader reader = new StreamReader(stream); //convert stream 2 string
string text = reader.ReadToEnd();