zoukankan      html  css  js  c++  java
  • 读取嵌入的资源文件

                  var ass = Assembly.Load("cn.fstudio.me.report");
                    var names = ass.GetManifestResourceInfo("cn.fstudio.me.report.Alarm.rdlc");
                    using (var stream = ass.GetManifestResourceStream("cn.fstudio.me.report.Alarm.rdlc"))
                    {
                        StreamReader sr = new StreamReader(stream);
                        var xml= sr.ReadToEnd();
                        sr.Close();
                    }
                    //using (var ms = new MemoryStream())
                    //{
                    //    Stream stream=   ass.GetManifestResourceStream("cn.fstudio.me.report.Alarm.rdlc");
                    //    byte[] buffer=new byte[1024];
                    //    int readLen=stream.Read(buffer,0,buffer.Length);
                    //    while(readLen>0){
                    //        ms.Write(buffer, 0, readLen);
                    //        readLen = stream.Read(buffer, 0, buffer.Length);
                    //    }
                    //    stream.Close();

                    //    //ms.Seek(0, SeekOrigin.Begin);
                    //    ms.Position = 0;
                    //    StreamReader sr = new StreamReader(ms, Encoding.UTF8);
                    //    var xml= sr.ReadToEnd();
                    //    sr.Close();
                    //}

  • 相关阅读:
    环境装好,开始学习
    懒惰了
    我的net试验田
    时间不够用
    【转帖】关于委托的精彩解说(非常形象)
    【转帖】 CLR 全面透彻解析:托管和本机代码互操作性
    【转贴】C#中的API32
    【转帖】Windows Mobile 开发系列文章收藏 Windows Mobile 6.x
    弹跳圣经——扣篮梦
    【转帖】.Net中C#的DllImport的用法
  • 原文地址:https://www.cnblogs.com/wdfrog/p/3342528.html
Copyright © 2011-2022 走看看