C#配置升级

 void ConvertProject()
{
List<BaseProjectConverter> convertors = new List<BaseProjectConverter>();
Assembly archiverAssembly = this.GetType().Assembly;
foreach (Type type in archiverAssembly.GetTypes())
{
if (type.IsSubclassOf(typeof(BaseProjectConverter))) //是否是子类
convertors.Add(Activator.CreateInstance(type) as BaseProjectConverter);
}
if (CurrentVersion > Version)
{
for (int i = ; i < convertors.Count; i++)
{
BaseProjectConverter conv = convertors[i];
if (conv.AcceptedVersion == Version && conv.ResultVersion <= CurrentVersion)
{
conv.Convert(this);
convertors.RemoveAt(i);
i = ;
}
}
}
else
{
for (int i = ; i < convertors.Count; i++)
{
BaseProjectConverter conv = convertors[i];
if (conv.ResultVersion == CurrentVersion && conv.AcceptedVersion >= Version)
{
conv.ConvertBack(this);
convertors.RemoveAt(i);
i = ;
}
}
}
}
上一篇:C语言头文件中定义全局变量导致重复定义错误


下一篇:ASP.NET 使用Session,避免用户F5刷新时重复提交(转)