public SetNestedValues ( string section, string key, string>.IList |
||
section | string | |
key | string | |
values | string>.IList | |
return | void |
public void SetNestedValues(string section, string key, IList<KeyValuePair<string, string>> values)
{
if (String.IsNullOrEmpty(section))
{
throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "section");
}
if (values == null)
{
throw new ArgumentNullException("values");
}
var sectionElement = GetOrCreateSection(_config.Root, section);
var element = GetOrCreateSection(sectionElement, key);
foreach (var kvp in values)
{
SetValueInternal(element, kvp.Key, kvp.Value);
}
Save();
}
public void SetNestedValues(string section, string key, IList <KeyValuePair <string, string> > values) { // machine wide settings cannot be changed. if (IsMachineWideSettings) { if (_next == null) { throw new InvalidOperationException(NuGetResources.Error_NoWritableConfig); } _next.SetNestedValues(section, key, values); return; } if (String.IsNullOrEmpty(section)) { throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "section"); } if (values == null) { throw new ArgumentNullException("values"); } var sectionElement = GetOrCreateSection(_config.Root, section); var element = GetOrCreateSection(sectionElement, key); foreach (var kvp in values) { SetValueInternal(element, kvp.Key, kvp.Value); } Save(); }