随笔分类 -  c#知识点总结

一些遇到的问题总结
ref 和 out
摘要:1.使用ref关键字 可以 将 值类型 变量按照引用方式传递 static void Main(string[] args) { int a = 20; int b = Square(ref a); //传递参数时带上ref Console.WriteLine($"a的值:{a},b的值:{b}") 阅读全文

posted @ 2022-07-14 15:57 泰坦尼克号上的活龙虾 阅读(10) 评论(0) 推荐(0) 编辑

属性与对象的销毁
摘要:属性 属性:大家写了这么多年的 public string Name {get;set;} 你真的了解他吗? 说实话,在查阅资料之前,我也说不清楚!!! 上边的这种属性写法属于是自动属性,不能改变的,只能这么写;它的前身是 string name;//注意,在类中的变量 不写访问修饰符,默认为pri 阅读全文

posted @ 2022-07-12 23:06 泰坦尼克号上的活龙虾 阅读(25) 评论(0) 推荐(0) 编辑

小小定时器
摘要:1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Data; 5 using System.Drawing; 6 using System.Linq; 7 阅读全文

posted @ 2022-06-13 16:15 泰坦尼克号上的活龙虾 阅读(26) 评论(0) 推荐(0) 编辑

扩展方法小记
摘要:什么是扩展方法? 我的理解是:在变量原有基础上做 扩展 在原有基础上增加新业务,就是扩展方法 例子: 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 usi 阅读全文

posted @ 2022-06-13 10:55 泰坦尼克号上的活龙虾 阅读(30) 评论(0) 推荐(0) 编辑

记一次 缓存 更新
摘要:1小小应用: Dictionary<string, string> dic = new Dictionary<string, string>(); 2 dic.Add("巴萨主帅", "哈维"); 3 dic.Add("曼城主帅", "瓜迪奥拉"); 4 5 MemoryCache memoryCa 阅读全文

posted @ 2022-06-12 22:35 泰坦尼克号上的活龙虾 阅读(29) 评论(0) 推荐(0) 编辑

HasValue和Value ?和??的使用小技巧
摘要:1.HasValue 和 Value HasValue 是判断该值是否有值,返回的是bool类型的值,Value表示的就是该值的值 int? i = null; int? j = 21; Console.WriteLine(i.HasValue); >结果是 false Console.WriteL 阅读全文

posted @ 2022-01-16 23:13 泰坦尼克号上的活龙虾 阅读(754) 评论(0) 推荐(2) 编辑

Linq小知识点总结
摘要:1.linq查询表达式必须以form开头,并且必须以select或group子句结束,中间可以添加多个子句 例如:var list = from num in nums where num%2!=0 orderby num descending select num; 2.双重/多重 from语句 阅读全文

posted @ 2021-07-27 10:06 泰坦尼克号上的活龙虾 阅读(65) 评论(0) 推荐(0) 编辑

< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8

导航

统计

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