c# 笔记
循环添加时采用
StringBuilder sb = new StringBuilder(); if (bytes != null) { for (int i = 0; i < bytes.Length; i++) { sb.Append(bytes[i].ToString("X2")); } } return sb.ToString();
c# 判断对象是否是类实例
对象.GetType()==typeof(类型),
对象 is 类型,
c#泛型方法反射
方法:Serializer 下的 private static T Serialize<T>(byte[] msg) 泛型对应的 具体的类类型:type
反射:Type serializerType = typeof(Serializer);
MethodInfo mi = serializerType.GetMethod("Deserialize").MakeGenericMethod(type);
Record result = (Record)mi.Invoke(null, new object[] { ms });