using System.Collections.Generic;
namespace MadMilkman.Ini
{
///
/// Represents a collection of items.
///
///
public sealed class IniKeyCollection : IniItemCollection
{
internal IniKeyCollection(IniFile parentFile, IniSection parentSection, IniDuplication duplication, bool caseSensitive)
: base(parentFile, parentSection, 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 IniKey Add(string name) { return this.Add(name, null); }
///
/// Adds an item to the end of this collection.
///
/// The key's data, pair of key's name and key's value, to add to this collection.
/// that was added to this collection.
///
public IniKey Add(KeyValuePair nameValuePair) { return this.Add(nameValuePair.Key, nameValuePair.Value); }
///
/// Adds an item to the end of this collection.
///
/// Name of the to add to this collection.
/// Value of the to add to this collection.
/// that was added to this collection.
///
public IniKey Add(string name, string value)
{
var key = new IniKey(this.ParentFile, name, value);
this.Add(key);
return key;
}
///
/// 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 IniKey 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.
/// The key's data, pair of key's name and key's value, to insert to this collection.
/// that was inserted to this collection.
///
public IniKey Insert(int index, KeyValuePair nameValuePair){ return this.Insert(index, nameValuePair.Key, nameValuePair.Value); }
///
/// 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.
/// Value of the to insert to this collection.
/// that was inserted to this collection.
///
public IniKey Insert(int index, string name, string value)
{
var key = new IniKey(this.ParentFile, name, value);
this.Insert(index, key);
return key;
}
}
}