I am trying to dynamically load an encryption assembly but my GetType 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())
{
MessageBox.Show(t.Name.ToString());
// 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.
Here
print out the
FullNameof the type and after use thatFullNameto get the type from the assembly.