public static void RunStatically(PValue arg, StackContext sctx) { PValue dummy; if (arg.Type is ObjectPType) { var toDispose = arg.Value as IDisposable; if (toDispose != null) toDispose.Dispose(); else { var isObj = arg.Value as IObject; if (isObj != null) { isObj.TryDynamicCall( sctx, new PValue[0], PCall.Get, DisposeMemberId, out dummy); } } } else { arg.TryDynamicCall(sctx, new PValue[0], PCall.Get, DisposeMemberId, out dummy); } }