private bool RemovePostfixIfStringContains(ref string str) { if (Postfixes == null)//(PostfixesCount.Count() == 1 && PostfixesCount.First() == 0) { return(false); } bool contain = false; foreach (int count in PostfixesCount) { contain = Postfixes.Contains(str.Substring(str.Length - count, count)); if (contain) { str = str.Remove(str.Length - count, count); return(contain); } } return(contain); }
private bool KeysContainsSomePrePostfix(IDictionary <string, object> dict) { if (Prefixes != null && Postfixes != null) { return(dict.Any(kvp => { foreach (int count in PrefixesCount) { //contains some of the configurated prefixes or postfixes if (Prefixes.Contains(kvp.Key.Substring(0, count)) || Postfixes.Contains(kvp.Key.Substring(kvp.Key.Length - count, count))) { return true; } else { return false; } } return false; })); } else if (Prefixes != null) { return(dict.Any(kvp => { foreach (int count in PrefixesCount) { //contains some of the configurated prefixes if (Prefixes.Contains(kvp.Key.Substring(0, count))) { return true; } else { return false; } } return false; })); } else if (Postfixes != null) { return(dict.Any(kvp => { foreach (int count in PrefixesCount) { //contains some of the configurated postfixes if (Postfixes.Contains(kvp.Key.Substring(kvp.Key.Length - count, count))) { return true; } else { return false; } } return false; })); } return(false); //return dict.Any(kvp => (Prefixes.Contains(kvp.Key.Substring(0,) }