02 2014 档案

摘要:今天看了一位网友分享的面试题,有智力题也有计算机程序题,蛮有意思的,Link 在此:http://www.cnblogs.com/Elgin/p/3545206.html其中的收获有两条:1.在GB2312的编码中,数字和字母(也就是说ACSII码所能表示的字符)都编码成一个字节。所有的简体中文的汉字,被编码成两个字节。并且,汉字编码的两个字节,他们的第一个bite值都为1. 但在Unicode编码中,它会把所有字符(字母或汉字)都编码成两个字节。2.在C#中 string 类型变量的默认值为null, null与”“的区别在于,如果把一个string类型值赋为null, 则在编译时不给该变量 阅读全文
posted @ 2014-02-14 11:28 sun sun 阅读(363) 评论(0) 推荐(0)
摘要:默认情况下,C# console Application 的标准输出就是那个控制台窗口,有时候可以重定到文件,以下是实现代码:using System.IO;using System.Text;using System;var defaultEncoding = Encoding.Default;Console.WriteLine("开始时间:{0}",DateTime.Now.ToString());//重定向输出到一个文件中var stream = new FileStream("C:/log.txt",FileMode.Create);Consol 阅读全文
posted @ 2014-02-13 16:43 sun sun 阅读(5956) 评论(1) 推荐(0)
摘要:今天在C#里试了下它使用的default encoding:(我的电脑是中文的windows7)Encode defaultEncoding = Encode.Default;Console.WriteLine("the system default encoding: ",defaultEncoding.ToString());得出的结果是: DBCSCodePageEncoding, 于是对于这种编码很是奇怪,在网上搜寻了一翻,有所收获。1. C#里参 Encode.Defalut的解释是: Gets an encoding for the operation syst 阅读全文
posted @ 2014-02-13 15:17 sun sun 阅读(2334) 评论(1) 推荐(1)