摘要:
var date = new DateTime(1731, 11, 25); Console.WriteLine($"On {date:dddd, MMMM dd, yyyy} Leonhard Euler introduced the letter e to denote {Math.E:F5} 阅读全文
摘要:
一.声明一个MyClass对象 public class MyClass { public int MyField; } 二.获取RequiredAttribute类型信息 MyClass instance = new MyClass(); FieldInfo field = instance.Ge 阅读全文
摘要:
void M(object o1, object o2) { var t = (o1, o2); if (t is (int, string)) {} // test if o1 is an int and o2 is a string switch (o1) { case int: break; 阅读全文
摘要:
实例一: JsonSerializerSettings jsonSettings = new JsonSerializerSettings { DateFormatString = "yyyy-MM-dd HH:mm:ss.fff", }; Model model = new Model { Cre 阅读全文
摘要:
委托是一种安全封装方法的类型,类似于 C 和 C++ 中的函数指针。与 C 函数指针不同,委托是面向对象的、类型安全的。委托的类型由委托的名称定义。下面的示例声明一个名为的委托,该委托可以封装将字符串作为参数并返回 void 的方法: public delegate void Del(string 阅读全文
摘要:
1. 单一职责原则(Single Responsibility Principle)类T负责两个不同的职责:职责P1,职责P2。 using System; using System.Collections.Generic; using System.Linq; using System.Text; 阅读全文