how dynamic is .NET
-
hey folks, can anyone tell me if it's possible to alter a enumeration or a class during runtime? for example adding an item to a enumeration or exchanging a method with another? if not, what can i do to customize the host application with a 'add-in' which is loaded by the host application? thanks for hints bernd
-
hey folks, can anyone tell me if it's possible to alter a enumeration or a class during runtime? for example adding an item to a enumeration or exchanging a method with another? if not, what can i do to customize the host application with a 'add-in' which is loaded by the host application? thanks for hints bernd
Specify an interface for the add-in, then create a library with a class that implements the interface. Now you can load the library dynamically, and use the interface to access the object without having to use reflection for everything.
--- b { font-weight: normal; }
-
Specify an interface for the add-in, then create a library with a class that implements the interface. Now you can load the library dynamically, and use the interface to access the object without having to use reflection for everything.
--- b { font-weight: normal; }
hey Guffa, thanks. it's not that easy. i haven't the source code of the host application under my control :( btw. i wouldn't like to touch it. you say reflection...is reflection able to do things we speek about? till now i used reflection just "raedonly". regards, bernd
-
hey folks, can anyone tell me if it's possible to alter a enumeration or a class during runtime? for example adding an item to a enumeration or exchanging a method with another? if not, what can i do to customize the host application with a 'add-in' which is loaded by the host application? thanks for hints bernd
Although it is a complicated procedure you can use code dom to create/insert dynamic code, though I'm not sure of the value of this in your case. Exchanging one method for another can be done using a pattern, possible strategy or adapter.
only two letters away from being an asset
-
Although it is a complicated procedure you can use code dom to create/insert dynamic code, though I'm not sure of the value of this in your case. Exchanging one method for another can be done using a pattern, possible strategy or adapter.
only two letters away from being an asset
uiui, sounds crazy. the pattern should be implemented in the host application i think, isn't it? if i do the step to touch the code of the host application i haven't to go the long way round doing stuff with code dom and something like that. but this could be a powerfull plug-in mechanism...i'll give it a try later. thanks for your advice, bernd
-
hey Guffa, thanks. it's not that easy. i haven't the source code of the host application under my control :( btw. i wouldn't like to touch it. you say reflection...is reflection able to do things we speek about? till now i used reflection just "raedonly". regards, bernd
thebread wrote:
i haven't the source code of the host application under my control
Then the answer is no. You can't do it using .NET. Anything is possible. You could alter the executable file to make changes in the program, but there is no support what so ever for this in .NET. You are totally on your own to fiddle with the byte codes. For an example, to replace a method you would either have to overwrite the code in the method, or add additional code for a method and change every call to the original method to use the new method instead. Are you up to the task? Have you done any assembler programming, for instance? I've done a lot of assembler programming and even machine code programming myself, but I would hesitate to try what you are suggesting...
--- b { font-weight: normal; }