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

高端品牌网站建设兴田德润在哪儿怎么做旅游网站

高端品牌网站建设兴田德润在哪儿,怎么做旅游网站,嵌入式软件开发岗位职责,hexo与wordpress区别文章目录 前言新反射使用BindingFlags以公有属性使用举例运行结果 前言 我之前写过一篇博客#xff0c;是关于C# 反射的#xff0c;我那时候使用的C# 反射写起来还是比较麻烦#xff0c;需要获取Properies,再遍历Property#xff0c;再找到对应Property#xff0c;再使用… 文章目录 前言新反射使用BindingFlags以公有属性使用举例运行结果 前言 我之前写过一篇博客是关于C# 反射的我那时候使用的C# 反射写起来还是比较麻烦需要获取Properies,再遍历Property再找到对应Property再使用。特别的麻烦。 C# 反射泛型总结和应用 后来我在网上找了一下找到了个视频挺好的。 C#基础教程 Reflection应用简单使用反射打破常规 新反射使用 BindingFlags BindingFlags 是可以简化反射类型的参数。使用举例如下 //Public公有Instance实例 BindingFlags bindingFlags BindingFlags.Public | BindingFlags.Instance;反射会得到三大类 静态|非静态公有|私有属性|字段|方法 以公有属性使用举例 static async Task Main(string[] args){BindTest bindTest new BindTest();Type type bindTest.GetType();BindingFlags bindingFlags BindingFlags.Public | BindingFlags.Instance;FieldInfo? fieldInfo type.GetField(Field,bindingFlags);Console.WriteLine(fieldInfo?.GetValue(bindTest));fieldInfo?.SetValue(bindTest, 新字段值);Console.WriteLine(fieldInfo?.GetValue(bindTest));Console.WriteLine(******************);PropertyInfo? propertyInfo type.GetProperty(Property, bindingFlags);Console.WriteLine(propertyInfo?.GetValue(bindTest));propertyInfo?.SetValue(bindTest, 新属性值);Console.WriteLine(propertyInfo?.GetValue(bindTest));Console.WriteLine(******************);MethodInfo? method1 type.GetMethod(Method, bindingFlags);method1?.Invoke(bindTest, null);MethodInfo? method2 type.GetMethod(Method2, bindingFlags);method2?.Invoke(bindTest, new object[]{测试参数});MethodInfo? method3 type.GetMethod(Method3, bindingFlags);var res method3?.Invoke(bindTest, null);Console.WriteLine(res);Console.WriteLine(******************);Console.WriteLine(运行完成);}}public class BindTest {public string Field 公有字段;public string Property { get; set; } 公有属性;public void Method(){Console.WriteLine(公有函数);}public void Method2(string str){Console.WriteLine($公有参数函数{str});}public string Method3(){return 返回参数;} }运行结果 这里只将了简单的公有数据私有属性和静态属性也差不多这里我就不展开说明了。
http://www.dnsts.com.cn/news/22897.html

相关文章:

  • 一般购物网站有哪些模块用dw做网站首页
  • 吉林建设厅官方网站桂林市有几个区和县
  • 代刷网站只做软件吗做国外网站关键词用写
  • 2015微信网站资质类网站如何做优化
  • 如何做亚马逊备案的网站东莞网站建设dgjcwl
  • 张家港专业的网站制作公司数据库做网站
  • 最好的产品网站建设网站设计网站机构
  • 静态网站说明书活动策划方案步骤
  • 网站后台编辑器不显示天津做胎儿鉴定网站
  • 免费网站空间论坛网站通栏怎么做
  • 海报制作网站免费米拓cms建站系统
  • 做营销网站企业汽配网站源码
  • 企业网站要怎么建设丹徒建设网官方网站
  • 广东大唐建设网站从零学做网站
  • 网站技巧网站建设运营费用预算
  • 口腔网站建设html网页设计基础
  • 租车网站模板赣州seo快速霸屏
  • 遵义建站智慧团建的网址
  • 一个外国人做汉字网站安康市建设局网站
  • 泰州网站建设设计学校手机网站模板
  • 长沙门户网站建设公司深圳 网站设计公司价格
  • 做性视频网站有哪些永康做网站的
  • 招聘代做网站门户网页版登录入口
  • 怎么做免费推广网站网页设计尺寸一般多少像素
  • 论坛备案网站名称长沙高端网站建设服务
  • 建网站有哪些文件夹wordpress 字体类型
  • 可信赖的南昌网站建设湖南邵阳网
  • 网站建设技术培训公司没有网站如何做外贸
  • 毕业设计做视频网站好做么莱芜建设局网站
  • php网站后台无法上传图片网站建设 鸿