using System.Collections.Generic;
namespace MadMilkman.Ini
{
///
/// Represents a collection of items.
///
///
public sealed class IniSectionCollection : IniItemCollection
{
internal IniSectionCollection(IniFile parentFile, IniDuplication duplication, bool caseSensitive)
: base(parentFile, null, duplication, caseSensitive) { }
///
/// Adds an item to the end of this collection.
///
/// Name of the to add to this collection.
/// that was added to this collection.
///
public IniSection Add(string name) { return this.Add(name, null); }
///
/// Adds an item to the end of this collection.
///
/// Name of the to add to this collection.
/// The section's keys data, pairs of key's name and key's value, to add to this collection.
/// that was added to this collection.
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures",
Justification = "I don't want to use IDictionary, there is no need for such a contract because IEnumerable> is enough.")]
public IniSection Add(string name, IEnumerable> nameValuePairs)
{
var section = new IniSection(this.ParentFile, name, nameValuePairs);
this.Add(section);
return section;
}
///
/// Inserts an item to this collection at the specified index.
///
/// Zero-based index at which item should be inserted.
/// Name of the to insert to this collection.
/// that was inserted to this collection.
///
public IniSection Insert(int index, string name) { return this.Insert(index, name, null); }
///
/// Inserts an item to this collection at the specified index.
///
/// Zero-based index at which item should be inserted.
/// Name of the to insert to this collection.
/// The section's keys data, pairs of key's name and key's value, to insert to this collection.
/// that was inserted to this collection.
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures",
Justification = "I don't want to use IDictionary, there is no need for such a contract because IEnumerable> is enough.")]
public IniSection Insert(int index, string name, IEnumerable> nameValuePairs)
{
var section = new IniSection(this.ParentFile, name, nameValuePairs);
this.Insert(index, section);
return section;
}
}
}