看到这段代码发条短信
using System;
using System.Windows.Forms;
using System.Collections;
using System.Reflection;
namespace TestHashTable
{
/// <summary>
/// Cache 的摘要说明。
/// </summary>
public class Cache
{
private static System.Collections.Hashtable ht=new System.Collections.Hashtable();
private Cache()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public static System.Windows.Forms.Form GetForm(string formtype)
{
if(ht.Contains(formtype))
{
}
else
{
ht.Add(formtype,System.Activator.CreateInstance(System.Type.GetType(formtype)));
}
return ht[formtype] as Form;
}
public static Form GenerationForm(string type)
{
return System.Activator.CreateInstance(System.Type.GetType(type),false) as Form;
}
}
}
发表于 @ 2007年03月09日 10:11:00|评论(loading...)|编辑