Thanks JB.
  Probably you can help me here and I know you won't have a
problem :-)
I've written an embedded c# compiler which targets the DynamicMethod
feature of c#.
You write your dynamic code in pure c# and the compiler generates a
dynamic method on the fly.
Now assume that someone has written a c# method which will be compiled
for parser errors, verifiability
and then dynamically injected as a DynamicMethod ready to be executed
via delegate.

So here the user deals with pure c# code and not IL instructions.

for .e.g: the user calls a Method
int num = Int32.Parse("245"); typed in a text editor and invokes my
compiler.
Now during the method resolution phase I use Cecil to find the method
with the signature and would like to generate
the IL instructions for this method call.
So somehow If I am given a MethodInfo instead of a MethodDefinition, I
would pass the MethodInfo to
System.Reflection.Emit(Opcode opcode, MethodInfo minfo);
and get the IL instructions generated.

So you see Cecil plays a very important role in all this.

And JB is all about Cecil. So I look upon you for a great solution :-)



On Jun 30, 9:20 pm, Jb Evain <[email protected]> wrote:
> Hey,
>
> On Wed, Jun 30, 2010 at 6:13 PM, richa <[email protected]> wrote:
> >    Just want to know if this is possible since what I want is given a
> > string methodName to a TypeDefinition I would want it return a
> > MethodInfo instead of a MethodDefinition which I then pass it to
> > System.Reflection.Emit(Opcode , MethosInfo)
>
> Beside the obvious question: why would you want to do that?
>
> There's nothing built in for that, you'd have to assembly.load the
> assembly containing your type definition, get the corresponding Type,
> and get the method info yourself.
>
> --
> Jb Evain  <[email protected]>

-- 
--
mono-cecil

Reply via email to