相关文章  
  • 浅谈如何利用BartPE创建PE工具盘
  • Windows Mobile 2003 Second Edition 中 ActiveSync 编程模型的增强功能
  • 在完成所有绑定后仍然有许多要进行的操作
  • 在你的企业中管理Windows和应用程序
  • 动态加载用户控件的组件
  • 小心GDI+资源泄漏 -- 猜想 测试 应对全过程
  • 浅谈 C# 中的代码协同 (Coroutine) 执行支持
  • Internet Explorer 中编辑 OLE 嵌入文档
  • 教你通过 Emit 实现动态生成一个类
  • 如何才能在10046event自由漫步
  •   推荐  
      科普之友首页   专利     科普      动物      植物        天文   考古   前沿科技
     您现在的位置在:  首页 >>文献 >>培训

    在 C# 中处理结构内的数组源代码分析8

    公共的工具基类,负责通过 Reflection 提供类型的载入和存储功能,如
      以下内容为程序代码:
      
      public class BinaryBlock
      {
      private static readonly ILog _log = LogManager.GetLogger(typeof(BinaryBlock));
      
      public BinaryBlock()
      {
      }
      
      static public object LoadFromStream(BinaryReader reader, Type objType)
      {
      if(objType.Equals(typeof(char)))
      {
      return reader.ReadChar();
      }
      else if(objType.Equals(typeof(byte)))
      {
      return reader.ReadByte();
      }
      //...
      else if(objType.Equals(typeof(double)))
      {
      return reader.ReadDouble();
      }
      else if(objType.IsArray)
      {
      // 处理数组的情况
      }
      else
      {
      foreach(FieldInfo field in Cla 数据载入中...

    页码:[1] [2] [3] [4] [5] [6] [7] [8]8页、共8页

         

          设为首页       |       加入收藏       |       广告服务       |       友情链接       |       版权申明      

    Copyriht 2007 - 2008 ©  科普之友 All right reserved