static int FindLast(UtyRx.InternalUtil.MicroCoroutine mc) { var coroutines = mc.GetType().GetField("coroutines", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance); var enumerators = (IEnumerator[])coroutines.GetValue(mc); int tail = -1; for (int i = 0; i < enumerators.Length; i++) { if (enumerators[i] == null) { if (tail == -1) { tail = i; } } else { if (tail != -1) { throw new Exception("what's happen?"); } } } if (tail == -1) { tail = enumerators.Length; } return(tail); }
static int GetTailDynamic(UtyRx.InternalUtil.MicroCoroutine mc) { var tail = mc.GetType().GetField("tail", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance); return((int)tail.GetValue(mc)); }