vendredi 22 janvier 2016

Reference a collection from IL constructed method

I am building a dynamic method using reflection. Most tutorials and documentation (e.g. How to: Define and Execute Dynamic Methods or Creating method dynamically, and executing it) show a very simple example.

I trying to find a way to reference another assembly from the dynamic assembly.

For example, I would like to be able to construct the following function by using Reflection.Emit.

public static void f(int n)
{
    int[] arr = new arr[n];
    return arr.Max();
}

What would be the common way of doing this?





Aucun commentaire:

Enregistrer un commentaire