Best way to check if a DLL file is a CLR assembly in C#
问题 What is the best way to check if a DLL file is a Win32 DLL or if it is a CLR assembly. At the moment I use this code try { this.currentWorkingDirectory = Path.GetDirectoryName(assemblyPath); //Try to load the assembly. assembly = Assembly.LoadFile(assemblyPath); return assembly != null; } catch (FileLoadException ex) { exception = ex; } catch (BadImageFormatException ex) { exception = ex; } catch (ArgumentException ex) { exception = ex; } catch (Exception ex) { exception = ex; } if (exception