Mega Code Archive

 
Categories / C# Tutorial / Assembly
 

Get current app domain name

using System; using System.Reflection; using System.Collections.Generic; using System.Text;     class Program     {         static void Main(string[] args)         {             Console.WriteLine(AppDomain.CurrentDomain.FriendlyName);             Console.WriteLine(AppDomain.CurrentDomain.GetAssemblies().Length.ToString());             AppDomain ad = AppDomain.CreateDomain("MyDomain");             ad.SetData("MYVALUE", "new Value");             MyNameSpace.MyClass1 remoteType = (MyNameSpace.MyClass1)ad.CreateInstanceFromAndUnwrap("MyCode.dll", "MyNameSpace.MyClass1");             remoteType.DoWork();             AppDomain.Unload(ad);         }     }