判断一个DLL是不是程序集
class TestAssembly
{
static void Main()
{
try
{
System.Reflection.AssemblyName testAssembly =
System.Reflection.AssemblyName.GetAssemblyName(@"C:/WINDOWS/system/avicap.dll");
System.Console.WriteLine("Yes, the file is an Assembly.");
}
catch (System.IO.FileNotFoundException e)
{
System.Console.WriteLine("The file cannot be found.");
}
catch (System.BadImageFormatException e)
{
System.Console.WriteLine("The file is not an Assembly.");
}
catch (System.IO.FileLoadException e)
{
System.Console.WriteLine("The Assembly has already been loaded.");
}
}
}
posted on 2010-01-08 07:33 tongdengquan 阅读(130) 评论(0) 编辑 收藏 举报