简体   繁体   中英

Allow user to modify method from outside assembly?

Basically, I'm trying to write a library to help people with entity management for their games in C# and I was wondering if there's any way for the user to add functionality (similar to an override except they won't be inheriting from the class) to a method without directly changing the .dll? I know in C++ some people use callbacks and I was wondering if there's anything similar in C#?

One option (instead of modifying a method ) it to use a the MEF framework to allow users to extend your application.

The Managed Extensibility Framework or MEF is a library for creating lightweight, extensible applications. It allows application developers to discover and use extensions with no configuration required. It also lets extension developers easily encapsulate code and avoid fragile hard dependencies. MEF not only allows extensions to be reused within applications, but across applications as well.

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