/// <summary> 序列化(对象转字节数组) | Serialize(Convert object to bytes) </summary> /// <param name="typeName">自定义类型名称 | Custom type name</param> /// <param name="obj">对象(类或结构) | object(class or struct)</param> public static byte[] Serialize(string typeName, object obj) { LBType customType; if (!LBConfig.TryGetCustomType(typeName, out customType)) { throw new Exception("CustomType is null. Type name:" + typeName); } return(LBConverter.ToBytes(customType, obj)); }