intermediate-language

How to pass value when subscribing to event and obtain it when the event is triggered (DynamicMethod usage problems)

The task is to create event handlers in runtime. I need the one method to be called with different parameter value for different events. The events and their number are only known in runtime. So I'm trying to generate dynamic methods, each of which will be assigned to some event, but in general they all just pass some value to an instanc...

Is there any way to consume .NET 4.0 assemblies in Silverlight

Silverlight can only recognize its v2.0.5.0 assemblies. The way to consume .NET 2.x/3.x assemblies in Silverlight truly exists. If I want to call, such as the method of Json class provided by System.Runtime.Serialization assembly, which is just in .NET 4.0, not in Silverlight v2.0.5.0, what can I do? Can I only consume the class and me...

WPF click event triggering twice under specific build enviroment

We are facing a strange problem. We have a user control written in WPF and we have added a click event handler in the xaml file. On local system it works as expected. But when the build is generated on the server (where we have the code repository), we notice that the resultant build has a bug. The bug is that the click event is generate...

In .NET, how is access to private methods restricted?

In .NET, are private methods and properties enforced by the runtime or just by the compiler? If you try to call another object's private methods, the compiler will throw an access exception. What if you manually manipulate the IL or try to call via reflection -- will you be able to? Also, does it vary by runtime version (1.1 vs. 2.0 vs....

Mechanism to extract specific IL (.NET Intermediate Language) signatures from an assembly

I have a list of about 25 types found in the Microsoft .NET assembly mscorlib.dll where I need to extract the IL signatures of the class and its members. I want one file per type, with each signature on one line. So, for example, take the type System.Collections.Generic.Comparer<T> I want to extract the following from the assembly for...

What does an if look like in IL?

What does an if statement look like when it's compiled into IL? It's a very simple construct in C#. Can sombody give me a more abstract definition of what it really is? ...

Programmatically compare IL of two methods

I have a compiled assembly. I want to programmatically compare the method implementation of one of the methods in that assembly with something I expect. Is there a way I can compare their ILs? Even if I can get a byte array representation of any instruction set, I'll be in a good place. Help appreciated. ...

C# DLL to .il, to C++ DLL: problem with strings

I'm trying to export some functionality from C# so I can use it in my unmanaged C++ app. On my test project, I first I create a C# DLL with a simple function to write a string to a file. I then use ildasm to turn this into an intermediate language (.il file). The function in .il looks like so: // =============== CLASS MEMBERS DECL...

Three Address Code (TAC / 3AC)

While doing some reading, I came across the terms "Intermediate Language" and "3AC". IL, as I understand, is the middle "step" in the source code compilation process. More specifically, I'm reading about bytecode (Java) and C. The way I interpret it (correct me if am wrong) is; Source Code 1 (ex. Lisp) -> Intermediate Language (...