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();
                    //}

  • 相关阅读:
    Ubuntu中root用户和user用户的相互切换
    Linux扩展权限
    計蒜客/填志愿(匈牙利算法)
    計蒜課/排澇(Edmond-Karp)
    計蒜客/數正方形(dp)
    51nodcontest#24 A(xjb)
    計蒜客/节食的限制(01背包)
    計蒜客/小教官(xjb)
    atcoder#073D(枚舉)
    Educational Codeforces Round 20 C(math)
  • 原文地址:https://www.cnblogs.com/wdfrog/p/3342528.html
Copyright © 2011-2022 走看看