Sign In
Haibo Luo's weblog
Translate This Page
Translate this page
Powered by
Microsoft® Translator
Tags
DynamicMethod
IronPython
IronRuby
Miscellaneous
Pages
Reflection
Reflection.Emit
VisualStudio
Browse by Tags
MSDN Blogs
>
Haibo Luo's weblog
>
All Tags
>
ironpython
Tagged Content List
Blog Post:
IronPython: System.Reflection.Assembly object
Haibo Luo - MSFT
IronPython offers a little bit more love to the Assembly object instance: we can directly access the assembly's top-level members (namespace, public type) via the dot operation. System.Reflection provides many ways to let you hold the assembly object, such as Assembly.Load method, Type.Assembly property...
on
12 Mar 2008
Blog Post:
IronPython: System.Array
Haibo Luo - MSFT
When you start interop'ing with .NET in IronPython, sooner or later, you will find that you are in need of creating an array as argument. There are mainly 2 ways to create array objects: Array with type indexing (for one-dimensional array object only), and classic reflection API: Array.CreateInstance...
on
12 Mar 2008
Blog Post:
IronPython: ipyw.exe
Haibo Luo - MSFT
Each IronPython binary release ships two executable files: ipy.exe and ipyw.exe. Their (only) difference is, ipy.exe is a console application and ipyw.exe is a windows application. So given the following winform.py, ## winform.py import clr clr.AddReference( "System.Windows.Forms" ) from System...
on
12 Mar 2008
Blog Post:
IronPython: Accessing the .NET Field
Haibo Luo - MSFT
The .NET libraries normally do not expose the public field, but we can still find its' presence for certain scenarios. IronPython treats the .NET fields like python attribute. For python attribute, the typical operations are set, get and delete. In general, IronPython throws TypeError when deleting members...
on
28 Oct 2007
Blog Post:
VisualStudio as my IronPython editor
Haibo Luo - MSFT
The following steps are what I did to get Visual Studio ready as my IronPython (and IronRuby) editor. Install the latest internal dogfood build of Visual Studio 2008. you may use Visual Studio 2005 or download the VS 2008 public beta2 ; Download and install ASP.NET futures release (July...
on
17 Oct 2007
Blog Post:
IronPython: explicitly choose one method
Haibo Luo - MSFT
C# allows method overloading. Given an argument list, the compiler performs the overload resolution to select the best method to invoke. The chosen method token is baked into the assembly. IronPython does the method resolution at the IronPython run time ; for most scenarios, it has no problem in picking...
on
11 Oct 2007
Blog Post:
IronPython: Provide (or not) Argument for by-ref Parameter
Haibo Luo - MSFT
Python function may return multiple objects as a tuple. The .NET method can only return one object as the result of a call; in order to return more than one objects, by-ref parameters are needed. They are decorated with the parameter modifier (ref, out) in C#. Dictionary.TryGetValue (TKey key, out...
on
5 Oct 2007
Blog Post:
IronPython: Keyword Argument to Set .NET Property/Field
Haibo Luo - MSFT
Use keyword arguments to set properties or fields… you likely ask the question: where can we do this? IronPython allows it in the constructor call, the call against the .NET type. Such keyword should be the name of public field, or property (which is not read-only). After creating the object instance...
on
2 Oct 2007
Blog Post:
IronPython: Passing Arguments for a Call
Haibo Luo - MSFT
After getting a CLR type, we can play it like a python type. We can get the class/static methods using the dot operator ("attribute reference") on the type, or create an instance of it and then get the instance methods. In Python’s word, these methods are callable objects, and we can make " calls " on...
on
1 Oct 2007
Blog Post:
IronPython: Grab the .NET Type
Haibo Luo - MSFT
After loading the assembly by clr.AddReference and then import namespace, we are ready to take hold of types and down-level namespaces using " attribute references ". >>> import System >>> System.DateTime # type <type 'DateTime'> >>> System.Diagnostics # still namespace...
on
25 Sep 2007
Blog Post:
IronPython: clr.AddReference
Haibo Luo - MSFT
In order to interop with .NET libraries, we need first load in the assemblies we want to play with. The family of AddReference methods in the clr module serves the purpose. clr.AddReference clr.AddReferenceByName clr.AddReferenceByPartialName clr.AddReferenceToFile clr.AddReferenceToFileAndPath...
on
25 Sep 2007
Blog Post:
IronPython: import clr
Haibo Luo - MSFT
clr is an IronPython built-in module, which provides some functionalities in order to interop with .NET. When writing "import clr" in a python module, it means you intend to leverage the .NET libraries. One classical example is python string's methods. In IronPython, python type str is implemented by...
on
25 Sep 2007
Blog Post:
DebuggerTypeProxy for IronPython Old-style Class and Instance
Haibo Luo - MSFT
First I want to make it clear that this post means nothing related to IronPython's plan about debugging python code in the future; it serves more as an interesting example to demonstrate DebuggerTypeProxyAttribute and how types can be created dynamically and be used in the VS debugger windows to display...
on
3 Aug 2007
Blog Post:
System.Reflection-based ILReader
Haibo Luo - MSFT
Compared to what I posted previously here (or what was used in the DynamicMethod visualizer ), this new version introduced the Visitor pattern . A do-nothing visitor ILInstructionVisitor is included; the users can focus on their domain-specific logic by simply inheriting from it and overriding...
on
6 Nov 2006
Blog Post:
Use IronPython to Experiment .NET Libraries
Haibo Luo - MSFT
When working on .NET projects, we often need to find the right API or the proper parameters to pass in to a particular method. Usually we search MSDN or turn to other search engines to solve such issue. Some people, however, prefer first-hand experience over search; they perfer experimenting or playing...
on
18 Jan 2006
Page 1 of 1 (15 items)