📄 valuenamedesclist!1.cs
字号:
namespace Imps.Client.Pc
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
public class ValueNameDescList<T> : IList<ValueNameDesc<T>>, ICollection<ValueNameDesc<T>>, IEnumerable<ValueNameDesc<T>>, IList, ICollection, IEnumerable
{
private List<ValueNameDesc<T>> _list;
public ValueNameDescList()
{
this._list = new List<ValueNameDesc<T>>();
}
public ValueNameDescList(int capacity)
{
this._list = new List<ValueNameDesc<T>>(capacity);
}
public void Add(ValueNameDesc<T> item)
{
this._list.Add(item);
}
public void Add(T value, string name)
{
this.Add(new ValueNameDesc<T>(value, name));
}
public void Add(T value, string name, string desc)
{
this.Add(new ValueNameDesc<T>(value, name, desc));
}
public void AddRange(IEnumerable<ValueNameDesc<T>> collection)
{
this._list.AddRange(collection);
}
public void Clear()
{
this._list.Clear();
}
public bool Contains(ValueNameDesc<T> item)
{
return this._list.Contains(item);
}
public void CopyTo(ValueNameDesc<T>[] array, int arrayIndex)
{
this._list.CopyTo(array, arrayIndex);
}
public ValueNameDesc<T> FindByName(string name)
{
List<ValueNameDesc<T>>.Enumerator enumerator = this._list.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
ValueNameDesc<T> desc = enumerator.get_Current();
if (desc.Name == name)
{
return desc;
}
}
}
finally
{
enumerator.Dispose();
}
return null;
}
public ValueNameDesc<T> FindByValue(T value)
{
List<ValueNameDesc<T>>.Enumerator enumerator = this._list.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
ValueNameDesc<T> desc = enumerator.get_Current();
if (object.Equals(desc.Value, value))
{
return desc;
}
}
}
finally
{
enumerator.Dispose();
}
return null;
}
public IEnumerator<ValueNameDesc<T>> GetEnumerator()
{
return this._list.GetEnumerator();
}
public int IndexOf(ValueNameDesc<T> item)
{
return this._list.IndexOf(item);
}
public void Insert(int index, ValueNameDesc<T> item)
{
this._list.Insert(index, item);
}
public bool Remove(ValueNameDesc<T> item)
{
return this._list.Remove(item);
}
public void RemoveAt(int index)
{
this._list.RemoveAt(index);
}
void ICollection.CopyTo(Array array, int index)
{
this._list.CopyTo(array, index);
}
IEnumerator IEnumerable.GetEnumerator()
{
return this._list.GetEnumerator();
}
int IList.Add(object value)
{
return this._list.Add(value);
}
void IList.Clear()
{
this._list.Clear();
}
bool IList.Contains(object value)
{
return this._list.Contains(value);
}
int IList.IndexOf(object value)
{
return this._list.IndexOf(value);
}
void IList.Insert(int index, object value)
{
this._list.Insert(index, value);
}
void IList.Remove(object value)
{
this._list.Remove(value);
}
void IList.RemoveAt(int index)
{
this._list.RemoveAt(index);
}
public int Count
{
get
{
return this._list.get_Count();
}
}
public bool IsReadOnly
{
get
{
return this._list.get_IsReadOnly();
}
}
public ValueNameDesc<T> this[int index]
{
get
{
return this._list.get_Item(index);
}
set
{
this._list.set_Item(index, value);
}
}
int ICollection.Count
{
get
{
return this._list.Count;
}
}
bool ICollection.IsSynchronized
{
get
{
return this._list.IsSynchronized;
}
}
object ICollection.SyncRoot
{
get
{
return this._list.SyncRoot;
}
}
bool IList.IsFixedSize
{
get
{
return this._list.IsFixedSize;
}
}
bool IList.IsReadOnly
{
get
{
return this._list.IsReadOnly;
}
}
object IList.this[int index]
{
get
{
return this._list[index];
}
set
{
this._list[index] = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -