Assembly asm = typeof(TestClass).Assembly;
will get you the assembly as long as it is referenced. Otherwise, you would have to use a fully qualified name:
Assembly asm = null;
Type type = Type.GetType("TestNamespace.TestClass, ConsoleApplication1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null");
if (type != null)
{
asm = type.Assembly;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…