Achim
Achim

Reputation: 15702

Modify IL code on the fly

I want to modify .Net IL code of an existing class on the fly. Is that possible somehow? I found some references to the .Net Profiling API, but according to the documentation it does not support self modifying applications. The main purpose would be to replace getters and setters of some properties. Any hint would be very appreciated.

cheers, Achim

Upvotes: 4

Views: 1417

Answers (1)

user1228
user1228

Reputation:

I'd suggest you check out Mono Cecil. Don't think you can't use Mono binaries in your windows .NET application.

Cecil is like reflection on steroids. You can not only reflect over an assembly, but alter its IL and save the result.

Here's a decent webcast about doing this.

Upvotes: 3

Related Questions