当前位置: 首页 > news >正文

建设网站制作项目描述简道云crm管理系统

建设网站制作项目描述,简道云crm管理系统,利用表单大师做网站,wordpress 用户组权限设置1#xff0c;使用反映将一个对象的同名属性赋值给另一个对象 2, DataTable 转换成一个实体 3#xff0c;使用反射动态执行方法 4,根据属性信息来执行对应的方法 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using…1使用反映将一个对象的同名属性赋值给另一个对象 2, DataTable 转换成一个实体 3使用反射动态执行方法 4,根据属性信息来执行对应的方法 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Reflection; using System.Windows.Forms;namespace WindowsFormsApp2 {public partial class FrmReflection : Form{public FrmReflection(){InitializeComponent();}private void FrmReflection_Load(object sender, EventArgs e){//反射的使用场景//1使用反映将一个对象的同名属性赋值给另一个对象PA pA new PA();pA.ID 3;pA.Name PAName1;pA.Remark PARemark;PB pB ToPageInfoPB(pA);MessageBox.Show(pB.Name);//2,DataTable 转换成一个实体DataTable dt new DataTable();dt.Columns.Add(ID, typeof(int) );dt.Columns.Add(Name, typeof(string));dt.Columns.Add(Remark, typeof(string));DataRow dr dt.NewRow();dr[ID] 1;dr[Name] PaName2;dt.Rows.Add(dr);ListPA pAs GetValuePA(dt);MessageBox.Show(pAs[0].Name);//3使用反射动态执行方法Assembly assembly Assembly.GetExecutingAssembly();Type[] t assembly.GetTypes(); //通过Assembly获取程序集中所有的类//Assembly assembly1 Assembly.LoadFrom(QRCoder.dll);//通过DLL文件全名反射其中的所有类型Type[] t1 assembly.GetTypes(); //通过Assembly获取程序指定dll集中所有的类/Assembly ass Assembly.Load(WindowsFormsApp2);//通过程序集的名称反射Type t2 ass.GetType(WindowsFormsApp2.FrmReflection);//命名空间类object o Activator.CreateInstance(t2, null, null);//实例一个对象MethodInfo mi t2.GetMethod(Show1);//获取方法mi.Invoke(o, null);//执行方法//4,根据属性信息来执行对应的方法Type t3 ass.GetType(WindowsFormsApp2.IsPrint);//命名空间类var attribute Attribute.GetCustomAttribute(t3, typeof(BarcodeTagAttrib)) as BarcodeTagAttrib;if (attribute.BarcodeTpName IsPrint){//var instance Activator.CreateInstance(t2) as CtrlPlanITag;MethodInfo mi3 t3.GetMethod(show2);//获取方法//instance.show2();//执行方法object o1 Activator.CreateInstance(t3, null, null);//实例一个对象mi3.Invoke(o1, null);//执行方法}}public T ToPageInfoT(object model) where T : new(){T t new T();PropertyInfo property null;foreach (var item in typeof(T).GetProperties()){property model.GetType().GetProperty(item.Name);if (property ! null){item.SetValue(t, property.GetValue(model, null), null);}}return t;}public ListT GetValueT(DataTable dt) where T : new(){ListT list new ListT();Type type typeof(T);for (int i 0; i dt.Rows.Count; i){T t new T();for (int j 0; j dt.Columns.Count; j){PropertyInfo pro type.GetProperty(dt.Columns[j].ColumnName);if (pro ! null){if (dt.Rows[i][j] ! DBNull.Value){pro.SetValue(t, dt.Rows[i][j], null);}}}list.Add(t);}return list;}public void Show1() {MessageBox.Show(Show1);}}public class PA{public int ID { get; set; }public string Name { get; set; }public string Description { get; set; }public string Remark { get; set; }}public class PB{public int ID { get; set; }public string Name { get; set; }public string DeviceType { get; set; }public string DeviceName { get; set; }public string Remark { get; set; }}public class BarcodeTagAttrib : Attribute{public string BarcodeTpName { get; set; }}public interface CtrlPlanITag{void show2();}[BarcodeTagAttrib(BarcodeTpName IsNeedEnd)]public class IsNeedEnd : CtrlPlanITag{public void show2(){MessageBox.Show(IsNeedEndShow);}}[BarcodeTagAttrib(BarcodeTpName IsPrint)]public class IsPrint : CtrlPlanITag{public void show2(){MessageBox.Show(IsPrintShow);}} }
http://www.pierceye.com/news/458381/

相关文章:

  • 郑州建设银行网站wordpress数据库怎么设置
  • 电子商务网站实例php网站建设哪家好
  • 网站开发课程报告心得简单的网页设计作品欣赏
  • 网站建设用什么系统华为弹性云做网站
  • 莱芜高端网站建设报价网站色彩策划
  • 房地产项目网站做网站互联网公司有哪些
  • 凡科做网站友情链接怎么做wordpress广告位设置
  • org已经备案的网站wap网站建设服务
  • 企业网站模板免费下载企业网站模板免费完整版的网站模板
  • 外贸网站建设公司价格怎样做触屏版手机网站
  • 南宁站建好就够用秦皇岛微信推广平台
  • 物流公司做网站有用吗河北省住房和城乡建设网站
  • 网站举报官网seo站长论坛
  • 建站工具有哪些论坛网站建设总体要求
  • 公司网页网站建设 pptwordpress php 采集
  • 遵义网站开发公司舟山网站建设企业
  • 外贸网站一站式服务招网站建设销售
  • 绚丽的网站wordpress进入后台显示500
  • 威海城乡与住房建设部网站小颜自助建站系统
  • 域名怎么解析到网站做响应式网站需要学哪些知识
  • wordpress手机端慢seoer是什么意思
  • wordpress添加站点江苏廉政建设网站
  • 网站seo是什么做二维码推送网站
  • win7 iis默认网站设置游戏推广员
  • 湖北二师网站建设排名潍坊专业捞泵电话
  • 个人网站设计内容和要求萍乡网站制作公司
  • 合肥网站seo费用怎么把文章导入wordpress
  • 赣州网站推广哪家最专业阿里云wordpress数据库备份
  • 珠海专业网站建设公司做网站虚拟主机好还是
  • 做美图 网站有哪些wordpress哪些插件