Ste Ste - 1 year ago 169
C# Question

Assembly.GetType is returning null

I am trying to dynamically load an encryption assembly but my

is returning null, even though I am using the correct class name. Here's the code:

//Load encryption assembly.
Assembly encryptionAssembly = Assembly.LoadFrom("Encryption.dll");
foreach(Type t in encryptionAssembly.GetTypes())
// This shows "Encryption"
Type encryptionClass = encryptionAssembly.GetType("Encryption");
// But this returns null

I've got a bit of a headache with this one. The class is public and I've definitely spelled it correctly.

Thanks in advance.

Answer Source


MessageBox.Show(t.FullName.ToString()); //FULLNAME

print out the FullName of the type and after use that FullName to get the type from the assembly.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download