MCPcopy Create free account
hub / github.com/Tencent/xLua / AddDelegate

Method AddDelegate

Assets/XLua/Src/DelegateBridge.cs:55–79  ·  view source on GitHub ↗
(Type key, Delegate value)

Source from the content-addressed store, hash-verified

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 {

Callers 1

CreateDelegateBridgeMethod · 0.80

Calls 1

AddMethod · 0.45

Tested by

no test coverage detected