转换C#代码

0 c# ilgenerator

我需要在C#代码中模拟(使用ilGenerator.Emit)以下函数

public void AssignAttribute(ref ValueHolder output, Assignment assignment) {
    ResultAttribute attribute = null;

    if ( (attribute = output.MultipleResults.Find(delegate(ResultAttribute o) {
        return o.Name == assignment.Name;
    })) != null)
        attribute.Value = assignment.Value;
    }
Run Code Online (Sandbox Code Playgroud)

有谁能够帮我?

the*_*oop 7

要做的是在项目C#中编译该方法,然后查看它使用Reflector生成的程序集中的IL .您可以使用Emit轻松复制该IL,并进行所需的任何动态更改.