Ste Ste - 2 months ago 11x
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.



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.