Skip to content

IL Instruction Replacer #7

@sidristij

Description

@sidristij

As requirement, I need to replace newobj instruction with static method call. But, it may be helpful in future to have replacer for all instructions.

 TryReplaceInstruction( OpCodes.Newobj, OnNewobjectCall );

 var strange = new Object();

 // ...

 var TType OnNewobjectCall(TypeHandler type)
 {
     if(type == typeof(object).TypeHandler)
     {
          Console.WriteLine(Type.FromTypeHandler(type).Name);
     }
     return new object();
 }

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions