Determining Whether an Assembly Has Been Loaded Domain Neutral


.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());       }    } }



    Customizing the Microsoft  .NET Framework Common Language Runtime
    Customizing the Microsoft .NET Framework Common Language Runtime
    ISBN: 735619883
    EAN: N/A
    Year: 2005
    Pages: 119

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net