/// <summary> /// 进行映射操作。 /// </summary> /// <param name="key"></param> /// <param name="value"></param> public static void Map(IDeleBase key, Delegate value) { if (key == null) { throw new Exception("[Dele_Map_Delegate::GetDelegate()] key == null."); } string strKey = key.GetKey(); m_Dict[strKey] = value; }
/// <summary> /// 销毁单个映射关系. /// </summary> public static void Destroy(IDeleBase key) { if (key == null) { throw new Exception("[Dele_Map_Delegate::Destriy()] key == null."); } string strKey = key.GetKey(); if (m_Dict.ContainsKey(strKey)) { m_Dict.Remove(strKey); } }
/// <summary> /// 获取 Delegate. /// </summary> /// <param name="key"></param> /// <returns></returns> public static Delegate GetDelegate(IDeleBase key) { if (key == null) { throw new Exception("[Dele_Map_Delegate::GetDelegate()] key == null."); } string strKey = key.GetKey(); if (!m_Dict.ContainsKey(strKey)) { //throw new Exception("[Dele_Map_Delegate::GetDelegate()] Count not find the key => " + key); return(null); } return(m_Dict[strKey]); }
/// <summary> /// 获取 Delegate. /// </summary> /// <param name="key"></param> /// <returns></returns> public static Delegate GetDelegate(IDeleBase key) { if (key == null) { throw new Exception("[Dele_Map_Delegate::GetDelegate()] key == null."); } string strKey = key.GetKey(); if (!m_Dict.ContainsKey(strKey)) { //throw new Exception("[Dele_Map_Delegate::GetDelegate()] Count not find the key => " + key); return null; } return m_Dict[strKey]; }