private static string GetGetValueErrorMessage <TKey, TValue>(IEnumerable <KeyValuePair <TKey, TValue> > dictionary, TKey key) { const int lengthCap = 500; var keysCharList = Alg.Intersperse(",", dictionary.Select(x => x.Key.ToString())).SelectMany(x => x.ToCharArray()); var errorMessage = "Failed to find key " + key.ToString() + " in dictionary containing keys [" + Alg.MergedChars(keysCharList.Take(lengthCap)) + (keysCharList.Skip(lengthCap).Any() ? " ...<truncated for length>" : "") + "]"; return(errorMessage); }
public static string LineFromCSVRow(IEnumerable <string> csvRow) { return(Alg.MergedStrings(Alg.Intersperse <string>(",", csvRow))); }