Used to set the default loader optimization policy for the main method of an executable application.
See Also: LoaderOptimizationAttribute Members
The LoaderOptimizationAttribute can only be set on the main method for an executable application and is ignored on all other methods.
The LoaderOptimizationAttribute attribute is specified with a LoaderOptimization enumeration value, which tells the loader what type of application to optimize for: SingleDomain, MultiDomain, or MultiDomainHost.
This attribute is only a hint to the loader and does not affect program behavior.
If custom code access security policy is set for the AppDomain, by using the AppDomain.SetAppDomainPolicy(System.Security.Policy.PolicyLevel) property, and the AppDomain is created using the LoaderOptimization.MultiDomain flag, the effect is the same as specifying the LoaderOptimization.MultiDomainHost flag; that is, only assemblies in the GAC are shared. When this occurs, the loader does not throw an exception and the application does not experience the performance gains associated with the LoaderOptimization.MultiDomain flag.