The following code gives the error “duplicate Key values not allowed”.
The values in the text file “Names” are definitely unique, so it has to be an issue with ToDictionary.
Can someone please point me to what I’m doing wrong, I’m new to lambda functions.
Dictionary<string, bool> langDictionary = new Dictionary<string, bool>();
char[] splitby = System.Environment.NewLine.ToCharArray();
var MytextAsset = Resources.Load ("Dictionaries/Names", typeof(TextAsset)) as TextAsset;
if (MytextAsset != null) {
langDictionary = MytextAsset.text.Split (splitby).ToDictionary (s=>s,s=>true);
}
Thanks in advance.