(Type key, Delegate value)
| 53 | } |
| 54 | |
| 55 | public void AddDelegate(Type key, Delegate value) |
| 56 | { |
| 57 | if (key == firstKey) |
| 58 | { |
| 59 | throw new ArgumentException("An element with the same key already exists in the dictionary."); |
| 60 | } |
| 61 | |
| 62 | if (firstKey == null && bindTo == null) // nothing |
| 63 | { |
| 64 | firstKey = key; |
| 65 | firstValue = value; |
| 66 | } |
| 67 | else if (firstKey != null && bindTo == null) // one key existed |
| 68 | { |
| 69 | bindTo = new Dictionary<Type, Delegate>(); |
| 70 | bindTo.Add(firstKey, firstValue); |
| 71 | firstKey = null; |
| 72 | firstValue = null; |
| 73 | bindTo.Add(key, value); |
| 74 | } |
| 75 | else |
| 76 | { |
| 77 | bindTo.Add(key, value); |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | public virtual Delegate GetDelegateByType(Type type) |
| 82 | { |
no test coverage detected