反射调用DLL

            Assembly ass = Assembly.UnsafeLoadFrom("BarcodeLib.dll");

            Type type = ass.GetType("BarcodeLib.Barcode");

            Type types = ass.GetType("BarcodeLib.TYPE");

            pictureBox1.Image = type.GetMethod("DoEncode", new Type[] { types, typeof(string), typeof(bool) }).Invoke(ass, new object[] { types.GetField("CODE11").GetValue(null), "123123213", true }) as Image;

你可能感兴趣的:(C#)