06 2022 档案
摘要:用字典存储多个对象 1 Dictionary<string, (Type onEntity, Type onJson)> dic = new Dictionary<string, (Type typ1, Type typ2)> 2 { 3 {"key", (typeof(int), typeof(s
阅读全文
摘要:除非是单价、金额之类的参数,否则一般的int要转为字符串来使用,我个人认为是毫无必要的。但既然有这个要求,只能实现一个转换器来处理。 1 class UnwiseIntToStrConvert : JsonConverter 2 { 3 public override bool CanConvert
阅读全文
摘要:对接口类型的属性显式应用转换器 public class IOrderMerchs { ...... } public class OrderMerchs : IOrderMerchs { ...... } public class Order { public string OrderId { g
阅读全文
摘要:两个参数的重载(参数1是入参,参数2是计算结果的输出) 1 // 具名委托 2 Func<int, string> f1 = Int32ToStr; // 引用了 Int32ToStr(int i) 3 4 // 匿名委托 5 Func<int, string> f2 = (int i) => {
阅读全文

浙公网安备 33010602011771号