Hey,

On Sat, Jun 12, 2010 at 3:13 AM, Kevin <[email protected]> wrote:
> Is there a way to take a reference to a System.Reflection.MethodInfo
> and convert it directly to a MethodDefinition?

There's no way in Mono.Cecil itself, but you can see examples of this
in the tests.

You can have a look for instance at ToDefinition:

http://github.com/jbevain/cecil/blob/master/Test/Mono.Cecil.Tests/Extensions.cs

Note that it probably won't work for instantiated generic methods.

> The reason I ask is because I want to convert a lambda expression to a
> method definition I can get the MethodInfo by casting the lambda
> expression to a Delegate and using the Method property.

It will work with the above method.

-- 
Jb Evain  <[email protected]>

-- 
--
mono-cecil

Reply via email to