您的位置:首页 > 其它

test

2015-08-05 16:19 253 查看
// 支持对非泛型集合的简单迭代
public interface IEnumerator
{
object Current { get; }                 // 获取集合中的当前元素
bool MoveNext();                        // 将枚举数推进到集合的下一个元素
void Reset();                           // 将枚举数设置为其初始位置,该位置位于集合中第一个元素之前
}


// 公开枚举数,该枚举数支持在非泛型集合上进行简单迭代
public interface IEnumerable
{
IEnumerator GetEnumerator();            // 返回一个循环访问集合的枚举器。
}


// 定义所有非泛型集合的大小、枚举数和同步方法
public interface ICollection : IEnumerable
{
int  Count { get; }                     // 取得当前集合元素个数
bool IsSynchronized { get; }            // 判断当前集合是否可同步访问(线程安全)
object SyncRoot { get; }                // 取得当前集合可同步访问的对象
void CopyTo(Array array, int index);    // 从当前集合索引index开始,复制元素到数组array中
}


// 列表接口:可按照索引单独访问的对象的非泛型集合。
public interface IList : ICollection, IEnumerable
{
object this[int index] { get; set; }    // 获取或设置位于指定索引处的元素
bool IsFixedSize { get; }               // 判断当前集合是否大小固定(不可扩展)
bool IsReadOnly { get; }                // 判断当前集合是否只读
bool Contains(object value);            // 判断当前集合是否包含元素value
int  IndexOf(object value);             // 取得元素value的索引值
int  Add(object value);                 // 添加元素
void Insert(int index, object value);   // 在索引指定位置插入元素value
void Remove(object value);              // 移除第一个匹配的元素value
void RemoveAt(int index);               // 移除索引指定的元素
void Clear();                           // 清空列表
}


// 字典接口:键/值对的非通用集合。
public interface IDictionary : ICollection, IEnumerable
{
object this[object key] { get; set; }   // 获取或设置位于指定索引处的元素
bool IsFixedSize { get; }               // 判断当前集合是否大小固定(不可扩展)
bool IsReadOnly { get; }                // 判断当前集合是否只读
ICollection Keys { get; }               // 根据key取得集合元素
ICollection Values { get; }             // 根据value集合元素
IDictionaryEnumerator GetEnumerator();  // 取得当前集合迭代器
bool Contains(object key);              // 判断当前集合是否存在含有key值的元素
void Add(object key, object value);     // 添加元素
void Remove(object key);                // 移除key指定的元素
void Clear();                           // 清空字典
}


// 公开枚举数,该枚举数支持在指定类型的集合上进行简单迭代。
public interface IEnumerable<out T> : IEnumerable
{
IEnumerator<T> GetEnumerator();         // 返回一个循环访问集合的枚举器。
}


// 定义操作泛型集合的方法。
public interface ICollection<T> : IEnumerable<T>, IEnumerable
{
int  Count { get; }                     // 取得当前集合元素个数
bool IsReadOnly { get; }                // 判断当前集合是否只读
void CopyTo(T[] array, int arrayIndex); // 从当前集合索引index开始,复制元素到数组array中
bool Contains(T item);                  // 判断当前集合是否存在元素item
void Add(T item);                       // 添加元素
bool Remove(T item);                    // 移除元素
void Clear();                           // 清空集合
}


// 表示可按照索引单独访问的一组对象。
public interface IList<T>
: ICollection<T>
, IEnumerable<T>
, IEnumerable
{
T this[int index] { get; set; }         // 获取或设置位于指定索引处的元素
int  IndexOf(T item);                   // 取得item元素的索引值
void Insert(int index, T item);         // 在索引index指定的位置插入元素item
void RemoveAt(int index);               // 移除指定位置的元素
}


// 表示键/值对的泛型集合。
public interface IDictionary<TKey, TValue>
: ICollection<KeyValuePair<TKey, TValue>>
, IEnumerable<KeyValuePair<TKey, TValue>>
, IEnumerable
{
TValue this[TKey key] { get; set; }     // 获取或设置位于指定索引处的元素
ICollection<TKey> Keys { get; }         // 取得键集
ICollection<TValue> Values { get; }     // 取得值集
bool ContainsKey(TKey key);             // 判断是否包含指定键的元素
void Add(TKey key, TValue value);       // 添加键/值对元素
bool Remove(TKey key);                  // 移除key指定的元素
// 取得key关联的值
bool TryGetValue(TKey key, out TValue value);
}


// 支持对非泛型集合的简单迭代
public interface IEnumerator
{
object Current { get; }
bool MoveNext();                        // 将枚举数推进到集合的下一个元素
void Reset();                           // 将枚举数设置为其初始位置,该位置位于集合中第一个元素之前
}


// 支持在泛型集合上进行简单迭代。。
public interface IEnumerator<out T> : IDisposable, IEnumerator
{
T Current { get; }                      // 获取集合中的当前元素
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: