ICode9

精准搜索请尝试: 精确搜索
  • vb.net listview 开启双缓存2022-08-15 13:00:39

        vb.net listview 刷新时闪烁  因为 Doublebuffered属性 为 protected 无法直接修改. 网友提供方法,使用反射 修改 DoubleBuffered 属性   LV1.[GetType]().GetProperty("DoubleBuffered", BindingFlags.Instance Or BindingFlags.NonPublic).SetValue(LV1, True, Nothing)

  • [C#] Epplus LoadFromCollection 按照指定格式导出Excel2022-06-28 16:35:07

    Epplus中利用对象集合来生成Excel内容,共有四种方式: public ExcelRangeBase LoadFromCollection<T>(IEnumerable<T> Collection); public ExcelRangeBase LoadFromCollection<T>(IEnumerable<T> Collection, bool PrintHeaders); public ExcelRangeBase LoadFromColle

  • C#如何取出非公共成员2022-06-21 10:34:58

    https://blog.csdn.net/yueguangzhiyuan/article/details/8926131   一般而言,非公共成员是受保护的,不能被外部访问的,这些都是基于安全性考虑。可是有时,我们很想取到非公共成员的某个对象。那我们就得用到两个方法:GetType().GetField();GetType().GetProperty();GetField()用来获取字段,Get

  • C# 在调用时检测子类是否对基类的方法进行了重写2022-05-20 12:03:04

    使用场景 public bool IsOverrideOnNothing() { var mName = nameof(OnNothing); var key = this.GetType().FullName + "_" + mName; if (!_overrideCache.ContainsKey(key)) { //查找 protected https://stackoverflow.com/questions/3393975/

  • 【Unity升级问题处理】Unity5.4.x升级到Unity2019遇到的坑-System.MissingMethodException2022-03-02 12:03:52

    原文链接:https://blog.csdn.net/u013294596/article/details/121565482 System.Reflection.BindingFlagsReadSelectedTable Error = System.MissingMethodException: TABLE.xxx.rows Due to: Attempted to access a missing member. at System.RuntimeType.InvokeMember (System

  • Unity开发笔记-Odin标签实现原理探究2022-02-16 23:34:13

    一些废话 为避免不必要的篇幅,本文中指列出关键代码。完整代码工程地址:https://github.com/terrynoya/HowCustomEditorBindWork Odin在Unity编辑器扩展中的地位不必多说。只需简单的标签,Odin就能自动为我们实现之前需要大量编码才能实现的扩展。下面来探究下其背后的原理,在实践中体

  • C# 反射相关2022-01-26 21:35:17

    参考:https://www.cnblogs.com/Kare/p/4601436.html https://www.cnblogs.com/sun-shadow/p/14478623.html 这个自己的 需要整合一下 1 class Program 2 { 3 public class NewClassw 4 { 5 public NewClassw() 6 { 7 } 8

  • C#自动创建快捷方式2021-10-10 20:33:00

    1.NET4.0之后动态类型版本 var startup = Environment.GetFolderPath(Environment.SpecialFolder.Startup); var lnkFilePath = Path.Combine(startup, "XXClient.lnk"); var shellType = Type.GetTypeFromProgID("WScript.Shell"); dynamic shell = Activator.Cr

  • DES/3DES算法_.net检测弱密钥2021-10-09 14:36:39

    参考文献https://blog.csdn.net/MHSMIE/article/details/52353111?spm=1001.2014.3001.5502 1 Type t = Type.GetType("System.Security.Cryptography.CryptoAPITransformMode"); 2 object obj = t.GetField("Encrypt", BindingFlags.Instance

  • C# 自定义鼠标样式2021-09-27 16:00:46

    这里调用系统 API 的方式。 ▲ 样式效果 先准备好鼠标样式cur文件。 ▲ 鼠标样式文件 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace M

  • C# 反射设置属性帮助类2021-09-08 14:03:36

    来源:https://github.com/zhangjk1980/ModbusTcpControl_WPF using System; using System.Collections.Generic; using System.Linq; using System.Text; public static class PropertyMethodExtensions { #region[Property] public st

  • c#反射入门篇(Reflection)——MethodInfo 发现方法的属性2021-07-10 07:32:31

    网站:https://www.jianshu.com/p/52dc85668d00 也算记录自己的学习篇=。= 适合入门看 这里简单介绍下MethodInfo和他基本的几个方法 简介 MethodInfo就是通过反射指定类获取到的 属性并提供对方法函数数据的访问。 1.如何获取? Type.GetMethod(String) 获取该类的指定的名字String

  • 接口get方法body赋值2021-07-05 14:33:07

    try{ ///URL接口地址 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL); request.Proxy = null; request.KeepAlive = false; request.Method = "GET"; request.ContentType = "application/json; charset=UTF-8"; req

  • WPF获得触摸精度和触摸点2021-06-29 10:55:37

    title author date CreateTime categories WPF 获得触摸精度和触摸点 lindexi 2018-05-04 21:11:51 +0800 2018-5-4 21:8:4 +0800 WPF 触摸 本文主要告诉大家如何获得所有的触摸设备的触摸精度和触摸点数。 需要通过反射的方法才可以拿到触摸的精度。 使用 Tablet.Tabl

  • C#反射调用私有事件2021-06-29 09:57:19

    title author date CreateTime categories C# 反射调用私有事件 lindexi 2019-11-29 08:51:13 +0800 2018-09-19 20:44:19 +0800 C# 反射 在 C# 反射调用私有事件经常会不知道如何写,本文告诉大家如何调用 假设有 A 类的代码定义了一个私有的事件 class A {

  • C# 获取对象值,不获取地址2021-03-16 09:33:36

    /// <summary>/// 使用反射将一个对象的值赋值给另一个对象/// </summary>/// <param name="obj">原对象</param>/// <param name="newobj">新的对象</param>/// <returns></returns>public static T CopyToT<T>(object obj,

  • 【转】.Net负载均衡使用StateServer进行Session共享2021-03-12 23:05:49

    session的四种模式,默认的是Inproc 在负载均衡的时候使用这种模式会造成session不共享的问题,所以需要修改为StateServer模式 webconfig中SessionState需要修改为如下代码,其中stateConnectionString配置的连接是存储session的连接 可以是本机127.0.0.1。或者是其他的远程服务器,默

  • c#-反射-ui对象自动为model对象赋值-简单实验2021-03-09 21:57:59

    1.代码  using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace ConsoleApp1 { class Program { static void Main(strin

  • C# 获得串口句柄,供 Win32 API 使用2021-01-15 16:35:24

    C# 获得串口句柄,供 Win32 API 使用 废话不表,直接看代码 public static IntPtr GetCommHandle(System.IO.Ports.SerialPort sp) {//获得串口句柄,供 Win32 API 使用 IntPtr hComm = IntPtr.Zero; if(sp != null) { object stream

  • 剖析一款实现IOC的.NET框架2021-01-14 20:01:29

    IOC的含义在百度百科中这样解释: 是面向对象编程中的一种设计原则,可以用来减低计算机代码之间的耦合度。其中最常见的方式叫做依赖注入(Dependency Injection,简称DI),还有一种方式叫“依赖查找”(Dependency Lookup)。通过控制反转,对象在被创建的时候,由一个调控系统内所有对象的外界实体

  • C# Get 带body2020-10-21 18:02:07

    try { //System.GC.Collect(); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL); request.Proxy = null; request.KeepAlive = false; request.

  • 清除控件某个事件的所有响应函数2020-05-18 12:57:51

       public void ClearEvent(System.Windows.Forms.Control control, string eventName) { if (control == null) return; try { Type cType = control.GetType(); EventInfo ei = cType.GetEvent( eventName,

  • 关于多台机器之前session共享,sessionState mode="StateServer" 问题的困扰2020-05-14 09:04:36

    转载防丢:https://www.cnblogs.com/w3live/p/5570406.html   关于多台机器之前session共享,sessionState mode="StateServer" 问题的困扰 .net 多台机器共享session是很老的技术,一直很少用到session。 最近就出现了一个问题:三台前端,其中一台保存的session值死活不对,一样的环境,一

  • C#反射之使用绑定句柄减少进程的内存消耗2020-05-11 19:53:07

    最近在看反射方面的东西的时候,看到最后发现一个与内存优化相关的东西,在此记录一下: 以下是文中介绍的 MethodInfo 和 RuntimeMethodHandle 相互转换测试代码: 1 using System; 2 using System.Collections.Generic; 3 using System.Diagnostics; 4 using System.Reflectio

  • EF查询出来的model,与自已创建的modl,取值进行更新2020-03-31 20:08:22

    /// <summary>                          ///创建人:蒋云峰 ///日 期:2019/12/23 ///描 述:更新实体,与数据库实体进行对比 /// </summary> public class JyfUpdateModel { /// <summary> /// 当dataBaseObj与ne

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有