BEGroup.Utility.IniFile.RemoveSectionsStartsWith C# (CSharp) Method

RemoveSectionsStartsWith() public method

Removes all sections that with the name starts with the specified string.
public RemoveSectionsStartsWith ( string startsWith, bool ignoreCase = true ) : void
startsWith string Starts with string
ignoreCase bool true to ignore case; otherwise false
return void
        public void RemoveSectionsStartsWith(string startsWith, bool ignoreCase = true)
        {
            List<string> removes = new List<string>(_content.Count);
            foreach (string key in _content.Keys)
            {
                if ((ignoreCase ? key.ToLower() : key).StartsWith((ignoreCase ? startsWith.ToLower() : startsWith)))
                {
                    removes.Add(key);
                }
            }
            foreach (string key in removes)
            {
                _content.Remove(key);
            }
        }