c# 反射取其他项目的资源文件
反射获取其他项目里面的资源文件。
dll或exe里面
try { System.Reflection.Assembly dll = System.Reflection.Assembly.LoadFile(AppDomain.CurrentDomain.BaseDirectory + "Test.exe"); ResourceManager resourceManager = new ResourceManager(dll.GetName().Name + ".Properties.Resources", dll); object obj = resourceManager.GetObject(picName.Replace('-', '_')); if (obj == null) return new Bitmap(22, 16); return ((System.Drawing.Bitmap)(obj)); } catch { throw new ArgumentException("获取图片失败!"); }