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. freemarker从入门到精通

    目录 一:概述 二:Freemarker的Helloworld 三:freemarker模板语法 1.访问map中的key 2.访问POJO中的属性 3.取集合中的数据 4.判断 5.日期 6.Nul ...

  2. Java:程序不过是几行代码的集合

    程序不过是几行代码的集合.就像下面这样: public class Test { public static void main(String[] args) { System.out.println ...

  3. RocketMQ 升级到主从切换(DLedger、多副本)实战

    目录 1.RocketMQ DLedger 多副本即主从切换核心配置参数详解 2.搭建主从同步环境 3.主从同步集群升级到DLedger 3.1 部署架构 3.2 升级步骤 3.3 验证消息发送与消息 ...

  4. 案例:使用dbms_xplan.display_cursor无法获取执行计划

    案例:使用dbms_xplan.display_cursor无法获取执行计划 环境:RHEL 6.5 + Oracle 11.2.0.4 在一次测试中发现使用dbms_xplan.display_cu ...

  5. (五十九)c#Winform自定义控件-池子(工业)-HZHControls

    官网 http://www.hzhcontrols.com 前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. GitHub:https://github.com/kww ...

  6. .NET Core C# 中级篇2-7 文件操作

    .NET Core CSharp 中级篇2-7 本节内容为文件操作 简介 文件操作在我们C#里还是比较常见的,例如我们读取Excel.Txt文件的内容,在程序中,这些文件都是以流的方式读取进入我们内存 ...

  7. 常用类-CSV---OLEDB

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.D ...

  8. IDEA中新建SpringBoot项目时提示:Artifact contains illegal characters

    场景 一步一步教你在IEDA中快速搭建SpringBoot项目: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/87688277 ...

  9. C#基本语法<一>_入门经典

    基本信息 CIL和JIT CIL通用中间语言 JIT just-in-time使得CIT代码仅在需要时才编译 程序集 包含可执行文件.exe和库函数.dll和资源文件,不必把程序集集中到一个地方,全局 ...

  10. 配置linux 防火墙,只有固定IP和端口才能能访问完美解决

    //添加开放的端口和固定ip vi  /etc/sysconfig/iptables [root@root220156 /]# echo "unset MAILCHECK"> ...