exception - Validation of .NET assemblies in C#? -


How do you check whether the assembly is a valid .NET assembly loaded? I currently have this code but unmanaged DLL has thrown BadImageFormatException.

  string [] filepaths = Directory.GetFiles (Directory.GetCurrentDirectory (), "* .dll", SearchOption.AllDirectories); & Lt; Type & gt; Potential effects = new list & lt; Type & gt; (); Foreach (String phylaxate in the filepath) {assembly A = assembly. Loadfile (file path); PotentialEffects.AddRange (a.GetTypes ()); }  

Can you just catch this exception?

See also this article here: Just catch the exception, assuming that a file is a valid assembly, the investigation will be much more expensive.


Comments

Popular posts from this blog

iphone - How do I make a UIPickerView in a UIActionSheet -

java - Is there an object like a "Set" that can contain only unique string values, but also contain a count on the number of occurrences of the string value? -