실행중인 클래스명을 조회
1 namespace NSCL
2 {
3 public partial class Form1 : Form
4 {
5 public Form1()
6 {
7 InitializeComponent();
8 this.Load += new EventHandler(Form1_Load);
9 }
10
11 void Form1_Load(object sender, EventArgs e)
12 {
13 GetClassNames();
14 }
15
16 private void GetClassNames()
17 {
18 List<string> clsNames = new List<string>();
19 Assembly asm = Assembly.GetExecutingAssembly();
20
21 foreach (Type t in asm.GetTypes())
22 {
23 if (t.BaseType.Name == "Form")
24 {
25 clsNames.Add(t.Name);
26 }
27 }
28
29 listBox1.DataSource = clsNames;
30 }
31 }
32 }