public static void with(IPython py, Action action) { try { py.__enter__(); action(); } catch (Exception ex) { throw ex; } finally { py.__exit__(); py.Dispose(); } }
[DebuggerNonUserCode()] // with "Just My Code" enabled this lets the debugger break at the origin of the exception public static void with(IPython py, Action <IPython> action) { try { py.__enter__(); action(py); } catch (Exception ex) { Console.WriteLine(ex.ToString()); throw; } finally { py.__exit__(); py.Dispose(); } }
public static TOut with <TIn, TOut>(IPython py, Func <TIn, TOut> action) where TIn : IPython { try { py.__enter__(); return(action((TIn)py)); } catch (Exception ex) { Console.WriteLine(ex.ToString()); return(default(TOut)); } finally { py.__exit__(); py.Dispose(); } }
public static void with <T>(IPython py, Action <T> action) where T : IPython { try { py.__enter__(); action((T)py); } catch (Exception ex) { Console.WriteLine(ex.ToString()); throw ex; } finally { py.__exit__(); py.Dispose(); } }
public PyPlot(IPython python) { this.python = python; }