public RemoveKeysStartsWith ( string section, string startsWith, bool ignoreCase = true ) : void | ||
section | string | Section name |
startsWith | string | Starts with string |
ignoreCase | bool | true to ignore case; otherwise false |
리턴 | void |
public void RemoveKeysStartsWith(string section, string startsWith, bool ignoreCase = true)
{
if (!ContainsSection(section)) return;
List<string> removes = new List<string>(_content.Count);
foreach (string key in _content[section].Keys)
{
if ((ignoreCase ? key.ToLower() : key).StartsWith((ignoreCase ? startsWith.ToLower() : startsWith)))
{
removes.Add(key);
}
}
foreach (string key in removes)
{
_content[section].Remove(key);
}
}