Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CombineImpl()

override Delegate System.MulticastDelegate.CombineImpl ( Delegate? follow)
inlinesealedprotectedvirtual

Reimplemented from System.Delegate.

Definition at line 181 of file MulticastDelegate.cs.

182 {
183 if ((object)follow == null)
184 {
185 return this;
186 }
187 if (!Delegate.InternalEqualTypes(this, follow))
188 {
189 throw new ArgumentException(SR.Arg_DlgtTypeMis);
190 }
192 int num = 1;
193 object[] array = multicastDelegate._invocationList as object[];
194 if (array != null)
195 {
196 num = (int)multicastDelegate._invocationCount;
197 }
198 int num2;
199 object[] array3;
200 if (!(_invocationList is object[] array2))
201 {
202 num2 = 1 + num;
203 array3 = new object[num2];
204 array3[0] = this;
205 if (array == null)
206 {
208 }
209 else
210 {
211 for (int i = 0; i < num; i++)
212 {
213 array3[1 + i] = array[i];
214 }
215 }
217 }
218 int num3 = (int)_invocationCount;
219 num2 = num3 + num;
220 array3 = null;
221 if (num2 <= array2.Length)
222 {
223 array3 = array2;
224 if (array == null)
225 {
227 {
228 array3 = null;
229 }
230 }
231 else
232 {
233 for (int j = 0; j < num; j++)
234 {
235 if (!TrySetSlot(array3, num3 + j, array[j]))
236 {
237 array3 = null;
238 break;
239 }
240 }
241 }
242 }
243 if (array3 == null)
244 {
245 int num4;
246 for (num4 = array2.Length; num4 < num2; num4 *= 2)
247 {
248 }
249 array3 = new object[num4];
250 for (int k = 0; k < num3; k++)
251 {
252 array3[k] = array2[k];
253 }
254 if (array == null)
255 {
257 }
258 else
259 {
260 for (int l = 0; l < num; l++)
261 {
262 array3[num3 + l] = array[l];
263 }
264 }
265 }
267 }
static bool TrySetSlot(object[] a, int index, object o)
MulticastDelegate NewMulticastDelegate(object[] invocationList, int invocationCount, bool thisIsMultiCastAlready)
MulticastDelegate(object target, string method)

References System.MulticastDelegate.MulticastDelegate(), System.MulticastDelegate._invocationCount, System.MulticastDelegate._invocationList, System.SR.Arg_DlgtTypeMis, System.array, System.Runtime.Serialization.Dictionary, System.Delegate.InternalEqualTypes(), System.MulticastDelegate.NewMulticastDelegate(), and System.MulticastDelegate.TrySetSlot().