合并两个visual studio .resx文件
本文关键字:visual studio resx 文件 两个 合并 | 更新日期: 2023-09-27 18:12:21
我有两个大的资源文件,我必须合并它们。两个文件中的Name属性可能是相同的
<data name="SomeResource" xml:space="preserve">
<value> The resource value </value>
</data>
如何获得所有相同的资源名称?
您可以使用一个小型控制台应用程序来获取所有重复的资源名称:
using System;
using System.Collections;
using System.Globalization;
using System.Linq;
class Program
{
static void Main(string[] args)
{
//replace with your strongly typed resource classes
var rm1 = MyApplication.Properties.Resources.ResourceManager;
var rm2 = MyApplication.Properties.Resources1.ResourceManager;
var rs1 = rm1.GetResourceSet(CultureInfo.CurrentUICulture, true, true);
var rs2 = rm2.GetResourceSet(CultureInfo.CurrentUICulture, true, true);
var result = from re1 in rs1.Cast<DictionaryEntry>()
join re2 in rs2.Cast<DictionaryEntry>()
on re1.Key equals re2.Key
select new { re1, re2 };
foreach (var item in result)
{
Console.Write("Key with name '"{0}'" is present in ",
item.re1.Key);
Console.WriteLine("both files ('"{0}'" and '"{1}'")",
item.re1.Value, item.re2.Value);
}
}
}