随笔分类 -  【学习】C#

摘要:# Dynamic与反射的使用 *【作者】长生* ### 实体类 ~~~ public class School{ public int GetAge(){ return 100; } } ~~~ ### 使用反射获取对象里的方法 ~~~ School school=new School(); va 阅读全文
posted @ 2023-07-26 16:20 月长生 阅读(12) 评论(0) 推荐(0) 编辑
摘要:详细链接:https://www.cnblogs.com/zhili/p/DesignPatternSummery.html 1、单例模式 #region 单例模式 /// <summary> /// 单例模式要求只有一个任务的时候创建 /// </summary> public class Sin 阅读全文
posted @ 2021-10-08 16:57 月长生 阅读(31) 评论(0) 推荐(0) 编辑
摘要:以下列表概述了类可以包含的成员类型。 常量:与类相关联的常量值 字段:与类关联的变量 方法:类可执行的操作 属性:与读取和写入类的已命名属性相关联的操作 索引器:与将类实例编入索引(像处理数组一样)相关联的操作 事件:类可以生成的通知 运算符:类支持的转换和表达式运算符 构造函数:初始化类实例或类本 阅读全文
posted @ 2021-10-08 16:56 月长生 阅读(31) 评论(0) 推荐(0) 编辑
摘要:using System; using System.Collections; namespace 预处理指令 { class Program { static void Main(string[] args) { GetArrayList(); GetStack(); Console.ReadKe 阅读全文
posted @ 2021-07-28 16:36 月长生 阅读(21) 评论(0) 推荐(0) 编辑
摘要:using System; namespace AbstractAndVirtual { class Program { static void Main(string[] args) { GetSharp getSharp= new GetSharp(); GetNewSharp getNewSh 阅读全文
posted @ 2021-07-28 16:06 月长生 阅读(13) 评论(0) 推荐(0) 编辑
摘要:多线程 using System; using System.Threading; namespace ThreadTest { class Program { static void Main(string[] args) { Thread th = Thread.CurrentThread; t 阅读全文
posted @ 2021-07-28 14:39 月长生 阅读(15) 评论(0) 推荐(0) 编辑
摘要:事件和委托的关系相当于属性和字段的关系,事件可以说是特殊的委托,下面是事件的简单练习1 using System; namespace EventTest { class Program { static void Main(string[] args) { Test t = new Test(); 阅读全文
posted @ 2021-07-28 10:19 月长生 阅读(26) 评论(0) 推荐(0) 编辑
摘要:委托顾名思义,即使将方法交给它,然后它去执行,定义的时候要注意委托返回值要和方法的返回值一致,参数类型和个数也要一致,现在直接上代码 using System; delegate void getNum(int a,int b);//定义委托返回值为空,两个参数类型int namespace del 阅读全文
posted @ 2021-07-28 09:53 月长生 阅读(31) 评论(0) 推荐(0) 编辑
摘要:using System; using System.Collections.Generic; namespace 泛型的基本使用练习 { class Program { static void Main(string[] args) { //泛型练习1 var a = "aa";var b = " 阅读全文
posted @ 2021-07-27 18:03 月长生 阅读(14) 评论(0) 推荐(0) 编辑
摘要:using System; using System.Reflection; namespace _1_反射 { class Program { static void Main(string[] args) { Type t = typeof(Ss); foreach (object item i 阅读全文
posted @ 2021-07-27 17:50 月长生 阅读(19) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示