Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How to get a DLR representation from C#?
- if (obj is IronPython.Runtime.List) {
- repr = ((IronPython.Runtime.List)obj).__repr__(
- IronPython.Runtime.DefaultContext.Default);
- } else if (obj is IronPython.Runtime.PythonDictionary) {
- repr = ((IronPython.Runtime.PythonDictionary)obj).__repr__(
- IronPython.Runtime.DefaultContext.Default);
- var engine = Python.CreateEngine();
- dynamic obj = engine.Execute("[1, 2, 3, 4, 5]");
- dynamic builtin = engine.GetBuiltinModule();
- string repr = builtin.str(obj);
- string repr = (string)engine.Execute("str([1, 2, 3, 4, 5])");
- string repr = IronPython.Runtime.Operations.PythonOps.ToString(obj);
- var engine = Ruby.CreateEngine();
- string repr = (string)engine.Execute("[1, 2, 3, 4, 5].to_s");
Add Comment
Please, Sign In to add comment