摘要:1.使用ref关键字 可以 将 值类型 变量按照引用方式传递 static void Main(string[] args) { int a = 20; int b = Square(ref a); //传递参数时带上ref Console.WriteLine($"a的值:{a},b的值:{b}")
阅读全文
摘要:属性 属性:大家写了这么多年的 public string Name {get;set;} 你真的了解他吗? 说实话,在查阅资料之前,我也说不清楚!!! 上边的这种属性写法属于是自动属性,不能改变的,只能这么写;它的前身是 string name;//注意,在类中的变量 不写访问修饰符,默认为pri
阅读全文
摘要: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
阅读全文
摘要:什么是扩展方法? 我的理解是:在变量原有基础上做 扩展 在原有基础上增加新业务,就是扩展方法 例子: 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 usi
阅读全文
摘要:1小小应用: Dictionary<string, string> dic = new Dictionary<string, string>(); 2 dic.Add("巴萨主帅", "哈维"); 3 dic.Add("曼城主帅", "瓜迪奥拉"); 4 5 MemoryCache memoryCa
阅读全文
摘要:1.HasValue 和 Value HasValue 是判断该值是否有值,返回的是bool类型的值,Value表示的就是该值的值 int? i = null; int? j = 21; Console.WriteLine(i.HasValue); >结果是 false Console.WriteL
阅读全文
摘要:1.linq查询表达式必须以form开头,并且必须以select或group子句结束,中间可以添加多个子句 例如:var list = from num in nums where num%2!=0 orderby num descending select num; 2.双重/多重 from语句
阅读全文