The LoaderOptimizationAttribute defines an enumerator that is used by the CLR to optimize the way this application will be loaded.
A good scenario to use the attribute is when you want to share resources (not static members) between application domains. The usage may have a performance penalty but if you need to have a lot of instances running a faster code or a single instance running slightly slower you’d rather to have the single instance.
The attribute must be defined on the main method of the application and if defined on a method other than the entry point, the attribute will be ignored and no exception will be thrown.
The following options are available to define the attribute:
SingleDomain: If you choose this option the loader will not share internal resources between application domains.
MultiDomain: Tells the loader that internal resources must be shared between application domains.
MultiDomainHost: Choosing this option will make the loader to share resources only for strongly-named assemblies registered on GAC.
Define the attribute is straightforward like any other attribute. Just type one of the following options before your application main method signature