public void CasWaitHandle_Handle () { MethodInfo mi = typeof (CasWaitHandle).GetProperty ("Handle", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).GetSetMethod (); CasWaitHandle cwh = new CasWaitHandle (); mi.Invoke (cwh, new object [1] { IntPtr.Zero }); // note: this works because CasWaitHandle doesn't have a LinkDemand on Handle // and yes this is a reason why LinkDemand are dangereous }
public void CasWaitHandle_Handle() { MethodInfo mi = typeof(CasWaitHandle).GetProperty("Handle", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).GetSetMethod(); CasWaitHandle cwh = new CasWaitHandle(); mi.Invoke(cwh, new object [1] { IntPtr.Zero }); // note: this works because CasWaitHandle doesn't have a LinkDemand on Handle // and yes this is a reason why LinkDemand are dangereous }