c# - Rewrite a method of a .Net DLL -


i have old .net dll have lost source code , wanted see if change behavior.

it has method takes in string , returns string.

i want rewrite method such can return

startstr + " test"; 

i tried .net reflector project produced has bunch of strange errors cannot recompile it.

i tried reflexil, offers assembly level changes.

is there way rewrite method in c# , have dll use method instead?

reflexil should able handle - need switch il view in reflector , can go method want change, pull reflexil , make changes. avoids problems decompiling assembly source code (which never worked me without errors in reflector).

if want append string string variable, can like:

// assuming original string on stack ldstr " test" call system.string system.string::concat ( system.string, system.string ) 

this create new string on stack test appended it. once you're done editing, can save assembly disk.

if need more complicated (like appending string returned function call), need call right method , call concat() on 2 strings on stack.

if original method returns string wrapping in new function in new assembly may better solution, though. i'd edit il if need original assembly change because - example - string returned particular method used within same assembly , need other functions in assembly see changed return value.

note: used reflector 6.8.2.5 , reflexil 1.0 - current reflector / reflexil may different. let me know if need these files changes.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -