Quantcast
Channel: Haibo Luo's weblog
Browsing all 35 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Member Order Returned by GetFields, GetMethods ...

As John mentioned in his post, every Reflection user should keep this in mind: our code should not count on the member order returned by GetFields, GetMethods and other similar GetXXXs calls. Given...

View Article



Image may be NSFW.
Clik here to view.

ILGenerator.EmitCall Mainly For vararg Methods

Vararg (variable arguments) methods accept argument lists of unknown length and type. CLR supports this by the IL instruction (arglist) and other BCL types, such as System.ArgIterator. C# compiler has...

View Article

Image may be NSFW.
Clik here to view.

Shift Away from CLR Reflection Area

After 2-year Reflection test ownership and 1-year babysitting for Reflection.Emit and DynamicMethod areas, I am gradually away from these CLR feature areas, and will be more focusing on IronPython (and...

View Article

Image may be NSFW.
Clik here to view.

Always Peverify IL Code of your Dynamic Method

Current dynamic method implementation does not have built-in support to pre-check whether the dynamic method code is verifiable. With bad IL sequence, very often you will get...

View Article

Image may be NSFW.
Clik here to view.

System.Reflection-based ILReader

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...

View Article


Image may be NSFW.
Clik here to view.

Turn MethodInfo to DynamicMethod

I do not know why anyone ever need this :) but few readers did ask me similar questions before. Solving this problem also demonstrates one more ILReader usage. To build a DynamicMethod, we can choose...

View Article

Image may be NSFW.
Clik here to view.

Take Two: IL Visualizer

I was glad to hear many positive feedbacks about the DebuggerVisualizer for DynamicMethod; on the sad side, it shows our lack of good LCG debugging support (on which, Mike Stall is seeking your...

View Article

Image may be NSFW.
Clik here to view.

Late-bound Array SetValue

The type "System.Array" provides us a set of API for the late-bound array operations, including array creation (Array.CreateInstance), read/write access to array element...

View Article


Image may be NSFW.
Clik here to view.

Name of Array Type

Two things related to array type name came to my mind while writing the previous post. Given an one-dimensional non-zero based double array x, x.GetType().ToString() returns "System.Double[*]"; we can...

View Article


Image may be NSFW.
Clik here to view.

DebuggerTypeProxy for IronPython Old-style Class and Instance

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...

View Article

Image may be NSFW.
Clik here to view.

IronPython: import clr

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...

View Article

Image may be NSFW.
Clik here to view.

IronPython: clr.AddReference

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...

View Article

Image may be NSFW.
Clik here to view.

IronPython: Grab the .NET Type

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...

View Article


Image may be NSFW.
Clik here to view.

IronPython: Passing Arguments for a Call

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...

View Article

Image may be NSFW.
Clik here to view.

IronPython: Keyword Argument to Set .NET Property/Field

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...

View Article


Image may be NSFW.
Clik here to view.

IronPython: Provide (or not) Argument for by-ref Parameter

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...

View Article

Image may be NSFW.
Clik here to view.

IronPython: explicitly choose one method

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...

View Article


Image may be NSFW.
Clik here to view.

VisualStudio as my IronPython editor

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...

View Article

Image may be NSFW.
Clik here to view.

IronPython: Accessing the .NET Field

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...

View Article

Image may be NSFW.
Clik here to view.

ILVisualizer VS2008 solution

I attached the ILVisualizer VS2008 solution in this post. There is no source code update; the only change is to upgrade the Microsoft.VisualStudio.DebuggerVisualizers.dll reference from version 8.0.0.0...

View Article
Browsing all 35 articles
Browse latest View live




Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>