Friday, January 16, 2009

AppDomain : Listing Assemblies within the Current AppDomain and Creating an new AppDomain (Code Snippet)

using System.Reflection;

private void Form1_Load(object sender, EventArgs e)
{
AppDomain dom = AppDomain.CurrentDomain;

Assembly[] loadedAssembly = dom.GetAssemblies();
foreach (Assembly a in loadedAssembly)
listBox1.Items.Add(a.GetName().Name );
}

private void btnCreateAppDomain_Click(object sender, EventArgs e)
{
AppDomain aDo = AppDomain.CreateDomain("Shalvin");

Assembly[] loadedAssembly = aDo.GetAssemblies();
foreach (Assembly a in loadedAssembly)
listBox2.Items.Add(a.GetName().Name);
}










Related Blogs
Reflection in .Net
.Net Intermediate Language

3 comments:

  1. Hi shal,

    what is the difference between ILDASM and ILASM

    ReplyDelete
  2. Ildasm(IL Disassembler) can be used for extracting il (Intermediate Language) from an assembly and Ilasm (IL Assembler) is used for generating an assembly from il.

    ReplyDelete
  3. Hi Shalvin!
    I saw your video on one to many data entry and your example on shalvin.com on point of sale,
    I wanted to thank you for that coz i learned some great things on ADO .NET
    especially for a beginner like me,
    Can you please give me a sample on a data entry for order and order
    details tables of the northwind database? Thanks so much!

    ReplyDelete