Exemplo n.º 1
0
 public void RegisterReturnMethod <T, RETTYPE>(ProvenceReturnDelegate <T, RETTYPE> del) where T : ARGTYPE
 {
     if (!returnDelegates.ContainsKey(typeof(T)))
     {
         returnDelegates[typeof(T)] = new Dictionary <Type, Delegate>();
     }
     returnDelegates[typeof(T)][typeof(RETTYPE)] = del;
 }
Exemplo n.º 2
0
 public void UnregisterReturnMethod <T, RETTYPE>(ProvenceReturnDelegate <T, RETTYPE> del) where T : ARGTYPE
 {
     if (returnDelegates.ContainsKey(typeof(T)) && returnDelegates[typeof(T)].ContainsKey(typeof(RETTYPE)))
     {
         var currentDel = Delegate.Remove(returnDelegates[typeof(T)][typeof(RETTYPE)], del);
         if (currentDel == null)
         {
             returnDelegates[typeof(T)].Remove(typeof(RETTYPE));
         }
         if (returnDelegates[typeof(T)].Count == 0)
         {
             returnDelegates.Remove(typeof(T));
         }
     }
 }