Wpf file embeded resource will compile the file into the assembly and it will be readonly and can not be writable.

using System.IO;
using System.Reflection; void ReadEmbededResourceDemo()
{
var assembly = Assembly.GetExecutingAssembly();
var names = assembly.GetManifestResourceNames();
var resourceName = "WpfApplication7.Resource.JsonData.json"; using (Stream stream = assembly.GetManifestResourceStream(resourceName))
using (StreamReader reader = new StreamReader(stream))
{
string result = reader.ReadToEnd();
MessageBox.Show(result);
}
}

While you set the file as Copy always it will copy the file and its folder to *.exe location.

 void WriteResourceAlwaysCopy()
{
string dir = Directory.GetCurrentDirectory();
var allFiles=Directory.GetFiles(dir, "*", SearchOption.AllDirectories);
var jsonFile = @".\Resource\JsonData.json";
string jsonContent=File.ReadAllText(jsonFile);
File.AppendAllText(jsonFile, jsonContent, Encoding.UTF8);
}

wpf file embeded resource is readonly,Copy always will copy the file and its folder to the bin folder的更多相关文章

  1. OGG报错:Cannot load ICU resource bundle 'ggMessage', error code 2 - No such file or directory

    [oracle@dgdb1 ~]$ ggsci Oracle GoldenGate Command Interpreter for OracleVersion 11.2.1.0.3 14400833 ...

  2. python deep copy and shallow copy

    Python中对于对象的赋值都是引用,而不是拷贝对象(Assignment statements in Python do not copy objects, they create bindings ...

  3. python中的shallow copy 与 deep copy

    今天在写代码的时候遇到一个奇葩的问题,问题描述如下: 代码中声明了一个list,将list作为参数传入了function1()中,在function1()中对list进行了del()即删除了一个元素. ...

  4. Shallow copy and Deep copy

    Shallow copy and Deep copy 第一部分: 一.来自wikipidia的解释: Shallow copy One method of copying an object is t ...

  5. AJ整理问题之:copy,对象自定义copy 什么是property

    AJ分享,必须精品 copy copy的正目的 copy 目的:建立一个副本,彼此修改,各不干扰 Copy(不可变)和MutableCopy(可变)针对Foundation框架的数据类型. 对于自定义 ...

  6. [CareerCup] 13.4 Depp Copy and Shallow Copy 深拷贝和浅拷贝

    13.4 What is the difference between deep copy and shallow copy? Explain how you would use each. 这道题问 ...

  7. (五)聊一聊深Copy与浅Copy

    一.关于浅copy与深copy 首先说明一下: 在python中,赋值其实就是对象的引用,变量就是对象的一个标签,如果把内存对象比喻成一个个房间,那么变量就是门牌号. 深copy与浅copy只是针对可 ...

  8. Cannot find ./catalina.sh The file is absent or does not have execute permission This file is nee

    从tomcat官网上下载了apache-tomcat-5.5.36.zip,在window xp系统里面解压以后,直接放在了linux服务器上. 进入tomcat/bin目录,执行启动的时候出现如下错 ...

  9. Python的深copy和浅copy

    浅拷贝(copy):拷贝父对象,不会拷贝对象的内部的子对象. 深拷贝(deepcopy): copy 模块的 deepcopy 方法,完全拷贝了父对象及其子对象. 浅copy: a = [1, 2, ...

随机推荐

  1. Flink| 运行架构

    1. Flink运行时组件 作业管理器(JobManager) 任务管理器(TaskManager) 资源管理器(ResourceManager) 分发器(Dispatcher) 2. 任务提交流程 ...

  2. win10系统怎么设置软件开机启动

    win10开机自动启动软件设置教程: 1:在windows10桌面,右键点击桌面左下角的开始按钮,在弹出的菜单中选择运行菜单项. 2:这时就会打开windows10的运行窗口,在窗口中输入命令shel ...

  3. IDEA生成可执行的jar文件

    场景 用IDEA开发一个Java控制台程序,项目完成后,打包给客户使用. 做法 首先用IDEA打开要生成jar的项目,打开后选择File->Project Structure... 选择Arti ...

  4. 【Linux命令】磁盘分区,格式化,挂载命令,创建交换分区(fdisk,mkfs,mount,umount)

    友情链接 磁盘分区,格式化,挂载,创建交换分区:https://www.cnblogs.com/HeiDi-BoKe/p/11936998.html RAID工作级别:https://www.cnbl ...

  5. el-dialog模态窗点击空白不消失

    通过查阅ElementUI的官方文档,可以发现Dialog对话框组件提供了一个close-on-click-modal属性来设置el-dialog模态窗点击空白不消失. <el-dialog : ...

  6. java架构之-负载均衡-Ribbon 的使用

    一. 什么是负载均衡负载均衡就是分发请求流量到不同的服务器.负载均衡一般分为两种:1. 服务器端负载均衡(nginx) 2. 客户端负载均衡(Ribbon) 二. spring- - cloud- - ...

  7. 【C#】学习笔记(3) 关于Events使用的小Demo

    关于Events事件的简单Demo. 目录结构: Program.cs using System; namespace EventsDemo { class Program { static void ...

  8. PgadminⅢ对PostgreSQL中的数据导出insert格式的SQL文档给别的数据库用

    导出的sql文件:

  9. 应用InstallShield 2015打包软件打包C#程序

    大家都明白,程序员写出的程序与用户直接使用的程序之间还有一个简单的环节,就是打包.今天就简单介绍下用InstallShield 2015打包工具进行程序的打包, 有兴趣的可以看看! 首先前面安装打包工 ...

  10. xBIM 综合使用案例与 ASP.NET MVC 集成(一)

    XbimWebUI是一个Javascript库,可用于BIM模型的Web表示.它使用WebGL并且独立于任何第三方WebGL框架.查看器的数据格式为WexBIM.不能直接加载IFC文件. 一.将IFC ...