1 |
william |
92 |
using System; |
2 |
|
|
using System.Collections.Generic; |
3 |
|
|
using System.Linq; |
4 |
|
|
using System.Text; |
5 |
|
|
using libxmltv.Interfaces; |
6 |
|
|
|
7 |
|
|
namespace libxmltv.Core |
8 |
|
|
{ |
9 |
|
|
public class PropertyList : PropertyList<string, object>, IPropertyList { } |
10 |
|
|
public class PropertyList<TKey, TValue> : IPropertyList<PropertyValuePair<TKey, TValue>> |
11 |
|
|
{ |
12 |
william |
95 |
private List<PropertyValuePair<TKey, TValue>> properties; |
13 |
|
|
public PropertyList() { properties = new List<PropertyValuePair<TKey, TValue>>(); } |
14 |
|
|
public PropertyList(IEnumerable<PropertyValuePair<TKey, TValue>> collection) { properties = new List<PropertyValuePair<TKey, TValue>>(collection); } |
15 |
|
|
public PropertyList(int capacity) { properties = new List<PropertyValuePair<TKey, TValue>>(); } |
16 |
|
|
public PropertyValuePair<TKey, TValue> this[int index] { get { return properties[index]; } set { properties[index] = value; } } |
17 |
|
|
public int IndexOfProperty(PropertyValuePair<TKey, TValue> item) { return properties.IndexOf(item); } |
18 |
|
|
public void InsertPropertyAtIndex(int index, PropertyValuePair<TKey, TValue> item) { properties.Insert(index, item); } |
19 |
|
|
public void RemovePropertyAt(int index) { properties.RemoveAt(index); } |
20 |
|
|
public int PropertyCount { get { return properties.Count; } } |
21 |
|
|
public bool IsReadOnly { get { return (properties as IPropertyCollection<TKey>).IsReadOnly; } } |
22 |
|
|
public void AddProperty(PropertyValuePair<TKey, TValue> item) { properties.Add(item); } |
23 |
|
|
public void ClearProperties() { properties.Clear(); } |
24 |
|
|
public bool ContainsProperty(PropertyValuePair<TKey, TValue> item) { return properties.Contains(item); } |
25 |
|
|
public void CopyPropertiesTo(PropertyValuePair<TKey, TValue>[] array, int arrayIndex) { properties.CopyTo(array, arrayIndex); } |
26 |
|
|
public bool RemoveProperty(PropertyValuePair<TKey, TValue> item) { return properties.Remove(item); } |
27 |
|
|
public IEnumerator<PropertyValuePair<TKey, TValue>> GetEnumerator() { return properties.GetEnumerator(); } |
28 |
|
|
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return this.GetEnumerator(); } |
29 |
william |
92 |
} |
30 |
|
|
} |