简体   繁体   中英

C# compiler/linker option: CSC.exe, somthing similar to --wrap in gcc?

In gcc, when we specify -Wl , --wrap=function_name , it replaces all the calls to "function_name" with "__wrap_function_name" and expects user to provide definition for "__wrap_function_name". It renames the original method as "__real_function_name".

This helps to hook any function in source code and of course we can call real method if we want.

is there similar option in C# compiler/linker ? I am trying to override some functions in managed dll. I have source code for that dll. I can't use any available mocking frameworks as my methods are internal and non-virtual.

No, I'm not aware of any such feature in C# in general or the Microsoft implementation in general.

If you've got the source code already, can you not change it appropriately? It sounds like you want it to be more extensible than it is - so add extensibility hooks yourself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM