using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
namespace zxy_console
{
class Program
{
static void Main()
{
try
{
//反射 查询应用程序集
System.Reflection.AssemblyName testAssembly =
System.Reflection.AssemblyName.GetAssemblyName(@"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll");
System.Console.WriteLine("Yes, the file is an Assembly.");
System.Console.ReadKey();
}
catch (System.IO.FileNotFoundException e)
{
System.Console.WriteLine("The file cannot be found.");
System.Console.ReadKey();
}
//badimageformatexception表示不是应用程序集
catch (System.BadImageFormatException e)
{
System.Console.WriteLine("The file is not an Assembly.");
System.Console.ReadKey();
}
catch (System.IO.FileLoadException e)
{
System.Console.WriteLine("The Assembly has already been loaded.");
System.Console.ReadKey();
}
}
}
}