How to set Object from Inherited class with Reflections
Im working on a framework for one of my libraries and my goal is to create a similar structure as Discord.NET
as stated in #How to create a structure like Discord.NET i have an issue with my
Context
object
Setting it using module.ModuleInteractionBase = (InteractionBase)Activator.CreateInstance(moduleType);
seems to work but the instance its setting seems to be different from what my command handler class inherits
2 Replies
Where are you obtaining
moduleType
? Can you share that code?i (kinda) solved my issue by just passing in the context as first parameter
ill get back to the auto assigning thingie later on when i update my work
but moduleType is a Reflection type of type T which inherits my InteractionBase class
or the entire Entry Assembly and then loops ober it depending on what register function i call but essentially its the same
public class that inherits InteractionBase