0

For example, in a C# file:

using library;
class Program
{
  static void Main (string[] args)
  {
    LibraryExample l = new LibraryExample();
    l.doStuff();
    // De-import it
  }
}

Would this be possible (not only in C#)? If yes, would you gain performance?
(I found a similar question and in Python you can del stuff not longer needed but this only makes you lose access about it and doesn't really drop the package)

Notiq
  • 21
  • 11
  • 3
    `using` directives only exist in the source code. The compiled assemblies have no trace of them. As such, [`using` is entirely unrelated to performance](https://stackoverflow.com/a/15392840/1430156). Seeing your remark about "dropping a package" in Python, are you may be mixing up `using` (basically, syntactic sugar for writing identifiers) and statically referencing an assembly vs. dynamically loading it? – O. R. Mapper Feb 09 '23 at 22:12
  • 1
    You can remove the `using` statement completely and just use namespace qualified names: `var l = new library.LibraryExample();`. It's the references you add to you app (directly or via NuGet) that use resources. You can't unload an assembly (i.e., a loaded DLL), so, no – Flydog57 Feb 09 '23 at 22:54

0 Answers0