摘要: public class A { } public static class B { public static void setError(this A a,int errorCode)//定义类A的扩展方法,前面是类型后面是参数 { } } public class C { public voi 阅读全文
posted @ 2022-04-16 17:04 春天花会开, 阅读(29) 评论(0) 推荐(0)
摘要: //定义事件,关键字'event',类型EventHandler<LogPrintEventArgs> public event EventHandler<LogPrintEventArgs> LogPrintCompleted { add { _logPrintCompleted -= value 阅读全文
posted @ 2022-03-24 17:37 春天花会开, 阅读(68) 评论(0) 推荐(0)
摘要: 【例子】: x/(2ˆ1)= x>>1x/(2ˆ2)= x>>2x/(2ˆ3)= x>>3x/(2ˆ4)= x>>4 ... x/(2ˆ30)= x>>30 【单位换算】 1 byte=1/(2^30)GB 【应用】:获取磁盘空间容量大小,byte转为GB显示 创建DriveInfo的实例drive 阅读全文
posted @ 2021-05-08 15:36 春天花会开, 阅读(236) 评论(0) 推荐(0)