How can I check if a library (dll) is available in C#?

后端 未结 2 1169
感情败类
感情败类 2021-01-27 04:25

How do I check if a library (dll) is available at runtime before I call it?

2条回答
  •  [愿得一人]
    2021-01-27 04:56

    You can use System.IO.File.Exists to check for the file if you know where it's located.

    You can use System.Reflection.Assembly.LoadFrom to load it.

    You'll need to use reflection to call methods in the dll if you use this form of late binding.

提交回复
热议问题