Created
April 14, 2019 21:12
-
-
Save alikrc/1ccc73886876efe310ee22f8acc1a76d to your computer and use it in GitHub Desktop.
this snippet finds duplicate keys on resx file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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