欢迎来到我的博客

记录编程技术与生活感悟

通过数组初始化位图

using System.Drawing; using System.Drawing.Imaging; using System.Runtime.InteropServices; using (var bitmap = new Bitmap(4, 2, PixelFormat.Format8bppIndexed)) { //bitmap.Palette.Entries[0] = Color.R
阅读全文 →

如何判断一个动态链接库是dotnet 生成的托管 DLL

在项目中做一个批量读取bin目录下的所有DLL动态装在到Ioc容器的功能,读取方法使用的 Assembly.LoadFrom(path); 常规情况下使用是没有问题的,但是如果程序依赖的某一个库本身还需要依赖非dotnet生成的非托管DLL,如sqlite的依赖库,使用这个方法就会报错,此为背景。 要解决这个问题最开始想到的方案是直接try catch 包围 Assembly.LoadFrom 语
阅读全文 →