Customizing the Microsoft .NET Framework Common Language Runtime

.NET Framework 2.0 introduces an API you can use to determine whether a given assembly was loaded domain neutral. The AssemblyIsDomainNeutral method on System.Diagnostics.Loader takes an assembly in the form of an instance of the System.Reflection.Assembly class and returns a boolean value indicating whether the assembly was loaded domain neutral, as shown in the following example:

using System; using System.Text; using System.Reflection; using System.Diagnostics; namespace DomainNeutralExample { public class Program { [LoaderOptimization(LoaderOptimization.MultiDomainHost)] static void Main(string[] args) { Assembly a = Assembly.Load(";Alinghi"); Console .WriteLine(a.FullName + " is loaded domain neutral: " + Loader .AssemblyIsDomainNeutral(a).ToString()); } } }

    Категории