03 2010 档案

C# Stream 和 byte[] 之间的转换
摘要: /// <summary> /// 将 Stream 转成 byte[] /// </summary> public byte[] StreamToBytes(Stream stream) { byte[] bytes = new byte[stream.Length]; stream.Read(bytes, 0, bytes.Length); // 设置当前流的位置为流的...阅读全文

posted @ 2010-03-18 15:57 chuncn 阅读(199) | 评论 (0) 编辑

c# struct 变量 到 byte[] 变量的转换操作
摘要: using System.Runtime.InteropServices;#region 需要转换的结构 [StructLayout(LayoutKind.Sequential, Pack=1)]//struTest变量在内存中的对齐方式 (指针类型转换成功的必要条件)public struct struTest{ public int intId; public int intName; pub...阅读全文

posted @ 2010-03-13 16:57 chuncn 阅读(412) | 评论 (0) 编辑

silverlight网络数据传输,unicode还是utf-8?
摘要: silverlight目前只支持unicode、BigEndianUnicode、utf-8三种编码,比较如下: "中华人民共和国" "hello""this is a tree.The three is grow"Unicode 14 1064UTF8 21 532BigEndianUnicode21532  由上可见,中文字符(全角)为主时,unicode的总字节数更加少,而英文字符(半角)为...阅读全文

posted @ 2010-03-10 10:07 chuncn 阅读(251) | 评论 (0) 编辑

Silverlight Unit Test简要介绍
摘要: Silverlight Unit Test一、搭建单元测试环境。1、自定义a.创建Silverlight Application。b.将.web删除。c.引进Microsoft.Silverlight.Testing.dll和Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll。d.修改App.cs文件。This.RootV...阅读全文

posted @ 2010-03-03 10:08 chuncn 阅读(275) | 评论 (0) 编辑