日期:2014-05-17 浏览次数:21582 次
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace HSERP.WMS.Entity.SysCfg
{
/// <summary>
/// 自定义键值对
/// </summary>
/// <typeparam name="B">键</typeparam>
/// <typeparam name="J">值</typeparam>
/// <typeparam name="F">值</typeparam>
[Serializable]
public class SuperDictionary<B, J, F>
{
public int Count = 0;
public List<B> Keys = new List<B>();
public List<MyValue<J, F>> Values = new List<MyValue<J, F>>();
#region 构造方法
public SuperDictionary()
{
}
#endregion
#region 根据键返回值
/// <summary>
/// 查询或添加
/// </summary>
/// <param name="b">键</param>
/// <returns></returns>
public MyValue<J, F> this[B b]
{
get
{
int i = Keys.IndexOf(Keys.First(a => a.Equals(b)));
return Values[i];
}
set
{
MyValue<J, F> mv = value as MyValue<J, F>;
int i = Keys.IndexOf(Keys.First(a => a.Equals(b)));
Values[i] = mv;
}
}
#endregion
#region 添加值
/// <summary>
/// 添