I am using .dll reference to my application. i want to unload the .dll in a button click event. How to do it ???
You can't unload an individual assembly - you have to unload a whole AppDomain
. In other words, you'll need to load your other assembly (and associated code) in a new AppDomain
, then when you want to unload it you unload the AppDomain
.
Of course, this makes life a lot harder as you have to worry about marshalling calls between AppDomains - but it's all that .NET allows.