Skip to content

Instantly share code, notes, and snippets.

@alikrc
Created April 14, 2019 21:12
Show Gist options
  • Save alikrc/1ccc73886876efe310ee22f8acc1a76d to your computer and use it in GitHub Desktop.
Save alikrc/1ccc73886876efe310ee22f8acc1a76d to your computer and use it in GitHub Desktop.
this snippet finds duplicate keys on resx file
var path = @"D:\XXX.resx";
var keyList = new List<string>();
var doc = new XmlDocument();
doc.Load(path);
foreach (XmlNode node in doc.DocumentElement.ChildNodes)
{
if (node.Name != "data")
{
continue;
}
keyList.Add(node.Attributes[0].Value);
}
keyList.Sort();
List<String> duplicates = keyList.GroupBy(x => x)
.Where(g => g.Count() > 1)
.Select(g => g.Key)
.ToList();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment