3

I have an assembly loaded into .NET reflector and I have the reflexil addin. I found a method in the assembly but it's private. Copying the whole method to my code is too much work because it uses many other methods in the assembly. I just want to change

private void Check(string Proxy, int Port)

to

public void Check(string Proxy, int Port)

So I can use it in my code. Does anybody know how to change it and how to save the fixed assembly after that?

Kirk

Tim Lloyd
  • 37,954
  • 10
  • 100
  • 130
Kirk
  • 89
  • 1
  • 5

1 Answers1

1

Instead of re-writing the assembly, consider using Reflection from your code to invoke the private method dynamically, see:

How do I use reflection to invoke a private method?

Community
  • 1
  • 1
Tim Lloyd
  • 37,954
  • 10
  • 100
  • 130
  • @Bart Agreed, it's a bit yucky. I would definitely recommend pairing it with a unit test to make sure there are no regressions if the 3rd party library is updated. – Tim Lloyd Aug 06 '11 at 12:43