public static bool WaitOne(System.Threading.ManualResetEvent evt, int ms) { if (mMethod != null) { return((bool)mMethod.Invoke(evt, new object[1] { ms })); } else { var type = evt.GetType(); mMethod = type.GetMethod("WaitOne", new System.Type[1] { typeof(int) }); return((bool)mMethod.Invoke(evt, new object[1] { ms })); } }
public static bool WaitOne(System.Threading.ManualResetEvent evt, System.TimeSpan timeSpan) { if (mMethod2 != null) { return((bool)mMethod2.Invoke(evt, new object[1] { timeSpan })); } else { var type = evt.GetType(); mMethod2 = type.GetMethod("WaitOne", new System.Type[1] { typeof(System.TimeSpan) }); return((bool)mMethod2.Invoke(evt, new object[1] { timeSpan })); } }