首页 > Windows开发 > 详细

C# 导出资源文件到硬盘

时间:2016-11-24 07:41:35      阅读:163      评论:0      收藏:0      [点我收藏+]

技术分享

 

我把一个exe应用程序添加了资源里面,

我想,程序运行之后,点击按钮之后,就把这个资源文件导出到硬盘,

代码如下:

private void button1_Click(object sender, EventArgs e)
        {
            byte[] temp = AuthDemo.Properties.Resources.LogView;
            System.IO.FileStream fileStream = new System.IO.FileStream(Application.StartupPath + @"\test.exe", System.IO.FileMode.CreateNew);
            fileStream.Write(temp, 0, (int)(temp.Length));
            fileStream.Close();
        }

我们导出到了程序运行目录,并且名称为test.exe,我们试下exe程序是否能正常运行,下面如图所示,能正常运行哈。

 

C# 导出资源文件到硬盘

原文:http://www.cnblogs.com/testsec/p/6095865.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!