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. 关于dom4j解析XML的问题分享

    最近在在做个程序需要将C#小工具转成java,因为需要涉及到操作xml文件所以需要引用dom4j: 使用dom4j解析XML时,要快速获取某个节点的数据,使用XPath是个不错的方法,dom4j的快速 ...

  2. adb devices无法连接mumu模拟器

    解决方案: 如果你的android环境能够直接访问 adb 的相关指令.只需要把mumu模拟器打开 然后打开cmd -> 输入 adb connect 127.0.0.1:7555 就能直接连上 ...

  3. node 升级版本

    1.安装 更新node.js版本 命令 [root@node ~]# npm install -g n /home/meisapp/node/node-v6.10.0-linux-x64/bin/n ...

  4. SpringBoot控制台版图书借阅程序

    // 实验存档... 效果图: 完整程序:https://pan.baidu.com/s/1-d1J90dkEtM0WKkABu0K0Q 提取码:hcnm DAO层代码由MyBatis Generat ...

  5. C++ 课程设计——电梯调度系统

    这是我在本学期C++课程最后的课程设计报告,源代码将会上传到GitHub上. 一.背景 随着经济的不断发展,越来越多的摩天大楼拔地而起,而电梯作为高层建筑物种的运送人员货物的设备也越来越被广泛使用.电 ...

  6. Android 视频播放器 (四):使用ExoPlayer播放视频

    一.简介 ExoPlayer是一个Android应用层的媒体播放器,它提供了一套可替换Android MediaPlayer的API,可以播放本地或者是线上的音视频资源.ExoPlayer支持一些An ...

  7. Android studio将一个项目作为module导入另一个项目

    有两个Android项目,一个为pozhudl,一个为app,现在欲将pozhudl项目作为module导入到app中,并调用pozhudl项目中的类 先在pozhudl项目的build.gradle ...

  8. 个人项目开源之Django文件中转站源代码

    可以当做文件中转站或网盘 源代码

  9. kotlinx.android.synthetic.** 坑点

    Kotlin通过添加 apply plugin: 'kotlin-android-extensions' 可以直接使用layout id 名称获取当前view对象,详细使用如下: //layout & ...

  10. ABP入门教程12 - 展示层实现增删改查-脚本

    点这里进入ABP入门教程目录 创建目录 在展示层(即JD.CRS.Web.Mvc)的\wwwroot\view-resources\Views\下新建文件夹Course //用以存放Course相关脚 ...