随笔分类 -  C#

摘要:delegate <T> 委托名<T>(T x, T y ...) 一、自定义 1、无参 using System; namespace ClassAndIn { internal class Program { static void Main(string[] args) { Dele dele 阅读全文
posted @ 2025-06-14 14:34 市丸银 阅读(7) 评论(0) 推荐(0)
摘要:1、关键字 enum 2、默认从0开始,可以赋值 3、可以有多个枚举值 4、案例 using System; namespace ClassAndIn { internal class Program { static void Main(string[] args) { Person person 阅读全文
posted @ 2025-06-14 09:18 市丸银 阅读(12) 评论(0) 推荐(0)
摘要:一、Action using System; namespace ClassAndIn { internal class Program { static void Main(string[] args) { Action action = Say; action(); Action<int> ac 阅读全文
posted @ 2025-06-14 08:51 市丸银 阅读(12) 评论(0) 推荐(0)
摘要:接口使用泛型,并被类实现接口 using System; namespace ClassAndIn { internal class Program { static void Main(string[] args) { // int 类型 Studnet<int> studnet = new St 阅读全文
posted @ 2025-06-14 08:14 市丸银 阅读(11) 评论(0) 推荐(0)
摘要:泛型 using System; namespace ClassAndIn { internal class Program { static void Main(string[] args) { Book book = new Book() { Name="love and peace"}; Bo 阅读全文
posted @ 2025-06-13 19:56 市丸银 阅读(12) 评论(0) 推荐(0)
摘要:接口默认 public abstract using System; namespace ClassAndIn { internal class Program { static void Main(string[] args) { // 多态 ICar car = new MiCar(); car 阅读全文
posted @ 2025-06-13 14:48 市丸银 阅读(9) 评论(0) 推荐(0)
摘要:抽象类和重写 using Mysqlx.Notice; using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using Syste 阅读全文
posted @ 2025-06-13 14:37 市丸银 阅读(12) 评论(0) 推荐(0)
摘要:class V { public virtual void Run() { Console.WriteLine("V Run"); } } class Car:V { public override void Run() { Console.WriteLine("Car Run"); } } 阅读全文
posted @ 2025-06-13 13:53 市丸银 阅读(14) 评论(0) 推荐(0)
摘要:一、委托 1、Action new Action(方法); 委派:无返回值 2、FunC 委派:有返回值 new Func<参数类型和返回值类型>(方法); using Mysqlx.Notice; using System; using System.Collections.Generic; us 阅读全文
posted @ 2025-06-13 09:52 市丸银 阅读(24) 评论(0) 推荐(0)
摘要:一、输出参数(out) string a = "10"; int.TryParse(a, out int c) 二、数组参数(params) (params int[] intArray) 阅读全文
posted @ 2025-06-13 09:03 市丸银 阅读(22) 评论(0) 推荐(0)
摘要:1、特点:传参会改变原值 2、格式:(ref int x, ref int y) static void Main(string[] args) { int a = 10; int b = 20; Add(ref a, ref b); Console.WriteLine("A:{0}", a); C 阅读全文
posted @ 2025-06-13 08:40 市丸银 阅读(20) 评论(0) 推荐(0)
摘要:一、全属性 propfull + Tab +Tab 可以修改类型、属性名、字段名(首字母大写) 二、简易属性 prop Tab Tab 可以修改类型和字段名(首字母大写) 阅读全文
posted @ 2025-06-12 23:22 市丸银 阅读(59) 评论(0) 推荐(0)