Jump to content
Tuts 4 You

[Dnlib, Mono.Cecil, C#] - How to replace an array of strings in FieldDef


Doctor

Recommended Posts

using ModuleDefMD module = ModuleDefMD.Load(Resources.Build);
foreach (TypeDef type in module.GetTypes()) 
{
    foreach (FieldDef field in type.Fields) 
    {     
       string[] MyTexts = new string[] { ".data", ".key" };
       field. ? = MyTexts; 

       //For byte array this replace
       //byte[] fake = new byte[] { 0x6B, 0x61, 0x6F };
       //field.InitialValue = fake;
    }
}

How to replace?

Edited by Doctor
Link to comment
  • The title was changed to [Dnlib, Mono.Cecil, C#] - How to replace an array of strings in FieldDef

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...