Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/275.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在资源中编辑字符串_C#_.net_Winforms - Fatal编程技术网

C# 在资源中编辑字符串

C# 在资源中编辑字符串,c#,.net,winforms,C#,.net,Winforms,如何在项目的资源中编辑字符串?我在尝试时出现以下错误: 无法将属性或索引器“Project.Properties.Resources.ExternalIp”分配给--它是只读的 我就是这么做的: Resources.ExternalIp = utf8.GetString(webClient.DownloadData("http://automation.whatismyip.com/n09230945.asp")); 资源不应该被写入;它们嵌入在可执行文件中,因此更改它们需要修改可执行文件 从

如何在项目的资源中编辑字符串?我在尝试时出现以下错误:

无法将属性或索引器“Project.Properties.Resources.ExternalIp”分配给--它是只读的

我就是这么做的:

Resources.ExternalIp = utf8.GetString(webClient.DownloadData("http://automation.whatismyip.com/n09230945.asp"));

资源不应该被写入;它们嵌入在可执行文件中,因此更改它们需要修改可执行文件


从您的代码来看,您实际上需要的似乎是资源,而不是资源。

属性。资源是只读的(“已编译”),您必须使用
属性。设置将作用域设置为“用户”,因此它将为“读写”

Project.Properties.Settings.Default.ExternalIp = utf8.GetString(webClient.DownloadData("http://automation.whatismyip.com/n09230945.asp"));
Project.Properties.Settings.Default.Save();