所谓的序列化其实就是把一个内存中的对象信息转化成一个可以持久化保存的形式,方便保存数据库和文件或着用于传输,

序列化的主要作用是不同平台之间进行通信与信息的传递保存等,常用的有序列化有Json Xml Binary Soap JavaScript序列化等,当然我们也可以使用第三方的序列化类库,第三方的序列化类库可以参照网上的,这里不再赘述,

本文主要介绍Json Xml Binary Soap JavaScript等6种序列化的方法,

添加引用以下类库

using System.Runtime.Serialization.Json;//DataContractJsonSerializer序列化
using System.Xml.Serialization;//XmlSerializer序列化
using System.Runtime.Serialization.Formatters.Binary;//BinarySerializer序列化
using System.Runtime.Serialization.Formatters.Soap;//SoapSerializer序列化
using System.Web.Script.Serialization;//JavaScriptSerializer序列化

代码如下:

using System;
using System.Text;
using System.IO;
using System.Runtime.Serialization.Json;//DataContractJsonSerializer序列化
using System.Xml.Serialization;//XmlSerializer序列化
using System.Runtime.Serialization.Formatters.Binary;//BinarySerializer序列化
using System.Runtime.Serialization.Formatters.Soap;//SoapSerializer序列化
using System.Web.Script.Serialization;//JavaScriptSerializer序列化 namespace SupremeConsole
{
/// <summary>
/// 序列化单例对象
/// </summary>
public class SerializeManager : SingleManager<SerializeManager>
{
public SerializeManager()
{
Initialize();
} public override void Initialize()
{
base.Initialize();
} /// <summary>
/// DataContractJson泛型序列化
/// </summary>
/// <typeparam name="T">泛型类型</typeparam>
/// <param name="t">泛型对象</param>
/// <returns>泛型对象序列化的字符串</returns>
public string DataContractJsonSerialize<T>(T t) where T : class
{
string s = null;
try
{
using MemoryStream ms = new MemoryStream();
DataContractJsonSerializer dcjs = new DataContractJsonSerializer(typeof(T));
dcjs.WriteObject(ms, t);
s = Encoding.UTF8.GetString(ms.ToArray());
}
catch (Exception ex)
{
Program.Log.Error($"DataContractJson泛型序列化错误信息:{ex.ToString()}");
}
return s;
} /// <summary>
/// DataContractJson泛型序列化
/// </summary>
/// <typeparam name="T">泛型类型</typeparam>
/// <param name="t">泛型对象</param>
/// <param name="path">保存的路径</param>
public void DataContractJsonSerialize<T>(T t, string path) where T : class
{
try
{
//string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "test.txt");
using FileStream fs = new FileStream(path, FileMode.OpenOrCreate);
DataContractJsonSerializer dcjs = new DataContractJsonSerializer(typeof(T));
dcjs.WriteObject(fs, t);
}
catch (Exception ex)
{
Program.Log.Error($"DataContractJson泛型序列化错误信息:{ex.ToString()}");
}
} /// <summary>
/// DataContractJson泛型的反序列化
/// </summary>
/// <typeparam name="T">泛型类型</typeparam>
/// <param name="json">反序列化的序列化文件路径</param>
/// <returns>泛型对象</returns>
public T DataContractJsonDeserializeJson<T>(string json) where T : class
{
T t = null;
try
{
using MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(json));
DataContractJsonSerializer dcjs = new DataContractJsonSerializer(typeof(T));
if (dcjs.ReadObject(ms) is T a)
{
t = a;
}
}
catch (Exception ex)
{
Program.Log.Error($"DataContractJson泛型反序列化错误信息:{ex.ToString()}");
}
return t;
} /// <summary>
/// DataContractJson泛型的反序列化
/// </summary>
/// <typeparam name="T">泛型类型</typeparam>
/// <param name="json">反序列化的序列化文件路径</param>
/// <returns>泛型对象</returns>
public T DataContractJsonDeserialize<T>(string path) where T : class
{
T t = null;
try
{
using MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(File.ReadAllText(path)));
DataContractJsonSerializer dcjs = new DataContractJsonSerializer(typeof(T));
if (dcjs.ReadObject(ms) is T a)
{
t = a;
}
}
catch (Exception ex)
{
Program.Log.Error($"DataContractJson泛型反序列化错误信息:{ex.ToString()}");
}
return t;
} /// <summary>
/// Xml泛型序列化
/// </summary>
/// <typeparam name="T">泛型类型</typeparam>
/// <param name="t">泛型对象</param>
/// <returns>泛型对象序列化的字符串</returns>
public string XmlSerialize<T>(T t) where T : class
{
string s = null;
try
{
using MemoryStream ms = new MemoryStream();
XmlSerializer xs = new XmlSerializer(typeof(T));
xs.Serialize(ms, t);
s = Encoding.UTF8.GetString(ms.ToArray());
}
catch (Exception ex)
{
Program.Log.Error($"Xml泛型序列化错误信息:{ex.ToString()}");
}
return s;
} /// <summary>
/// Xml泛型序列化
/// </summary>
/// <typeparam name="T">泛型类型</typeparam>
/// <param name="t">泛型对象</param>
/// <param name="path">保存的路径</param>
public void XmlSerialize<T>(T t, string path) where T : class
{
try
{
//string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "test.txt");
using FileStream fs = new FileStream(path, FileMode.OpenOrCreate);
XmlSerializer xs = new XmlSerializer(typeof(T));
xs.Serialize(fs, t);
}
catch (Exception ex)
{
Program.Log.Error($"Xml泛型序列化错误信息:{ex.ToString()}");
}
} /// <summary>
/// Xml泛型的反序列化
/// </summary>
/// <typeparam name="T">泛型类型</typeparam>
/// <param name="path">反序列化的序列化文件路径</param>
/// <returns>泛型对象</returns>
public T XmlDeserialize<T>(string path) where T : class
{
T t = null;
try
{
using MemoryStream ms = new MemoryStream(File.ReadAllBytes(path));
XmlSerializer xs = new XmlSerializer(typeof(T));
if (xs.Deserialize(ms) is T a)
{
t = a;
}
}
catch (Exception ex)
{
Program.Log.Error($"Xml泛型的反序列化错误信息:{ex.ToString()}");
}
return t;
} /// <summary>
/// Binary泛型序列化
/// </summary>
/// <typeparam name="T">泛型类型</typeparam>
/// <param name="t">泛型对象</param>
/// <returns>泛型对象序列化的字符串</returns>
public string BinarySerialize<T>(T t) where T : class
{
string s = null;
try
{
using MemoryStream ms = new MemoryStream();
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(ms, t);
s = Encoding.UTF8.GetString(ms.ToArray());
}
catch (Exception ex)
{
Program.Log.Error($"Binary泛型序列化错误信息:{ex.ToString()}");
}
return s;
} /// <summary>
/// Binary泛型序列化
/// </summary>
/// <typeparam name="T">泛型类型</typeparam>
/// <param name="t">泛型对象</param>
/// <param name="path">保存的路径</param>
public void BinarySerialize<T>(T t, string path) where T : class
{
try
{
//string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "test.txt");
using FileStream fs = new FileStream(path, FileMode.OpenOrCreate);
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(fs, t);
}
catch (Exception ex)
{
Program.Log.Error($"Binary泛型序列化错误信息:{ex.ToString()}");
}
} /// <summary>
/// Binary泛型的反序列化
/// </summary>
/// <typeparam name="T">泛型类型</typeparam>
/// <param name="path">反序列化的序列化文件路径</param>
/// <returns>泛型对象</returns>
public T BinaryDeserialize<T>(string path) where T : class
{
T t = null;
try
{
//string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "test.txt");
using MemoryStream fs = new MemoryStream(File.ReadAllBytes(path));
BinaryFormatter bf = new BinaryFormatter();
if (bf.Deserialize(fs) is T a)
{
t = a;
}
}
catch (Exception ex)
{
Program.Log.Error($"Binary泛型的反序列化错误信息:{ex.ToString()}");
}
return t;
} /// <summary>
/// Soap泛型序列化
/// </summary>
/// <typeparam name="T">泛型类型</typeparam>
/// <param name="t">泛型对象</param>
/// <returns>泛型对象序列化的字符串</returns>
public string SoapSerialize<T>(T t) where T : class
{
string s = null;
try
{
using MemoryStream ms = new MemoryStream();
SoapFormatter sf = new SoapFormatter();
sf.Serialize(ms, t);
s = Encoding.UTF8.GetString(ms.ToArray());
}
catch (Exception ex)
{
Program.Log.Error($"Soap泛型序列化错误信息:{ex.ToString()}");
}
return s;
} /// <summary>
///Soap泛型序列化
/// </summary>
/// <typeparam name="T">泛型类型</typeparam>
/// <param name="t">泛型对象</param>
/// <param name="path">保存的路径</param>
public void SoapSerialize<T>(T t, string path) where T : class
{
try
{
//string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "test.txt");
using FileStream fs = new FileStream(path, FileMode.OpenOrCreate);
SoapFormatter sf = new SoapFormatter();
sf.Serialize(fs, t);
}
catch (Exception ex)
{
Program.Log.Error($"Soap泛型序列化错误信息:{ex.ToString()}");
}
} /// <summary>
/// Soap泛型的反序列化
/// </summary>
/// <typeparam name="T">泛型类型</typeparam>
/// <param name="path">反序列化的序列化文件路径</param>
/// <returns>泛型对象</returns>
public T SoapDeserialize<T>(string path) where T : class
{
T t = null;
try
{
//string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "test.txt");
using MemoryStream fs = new MemoryStream(File.ReadAllBytes(path));
SoapFormatter sf = new SoapFormatter();
if (sf.Deserialize(fs) is T a)
{
t = a;
}
}
catch (Exception ex)
{
Program.Log.Error($"Soap泛型的反序列化错误信息:{ex.ToString()}");
}
return t;
} /// <summary>
/// JavaScript泛型序列化
/// </summary>
/// <typeparam name="T">泛型类型</typeparam>
/// <param name="t">泛型对象</param>
/// <returns>泛型对象序列化的字符串</returns>
public string JavaScriptSerialize<T>(T t) where T : class
{
string s = null;
try
{
JavaScriptSerializer jss = new JavaScriptSerializer();
s = jss.Serialize(t);
}
catch (Exception ex)
{
Program.Log.Error($"JavaScript泛型序列化错误信息:{ex.ToString()}");
}
return s;
} /// <summary>
///JavaScript泛型序列化
/// </summary>
/// <typeparam name="T">泛型类型</typeparam>
/// <param name="t">泛型对象</param>
/// <param name="path">保存的路径</param>
public void JavaScriptSerialize<T>(T t, string path) where T : class
{
try
{
//string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "test.txt");
using FileStream fs = new FileStream(path, FileMode.OpenOrCreate);
using StreamWriter sw = new StreamWriter(fs);
StringBuilder sb = new StringBuilder();
JavaScriptSerializer jss = new JavaScriptSerializer();
jss.Serialize(t, sb);
sw.WriteLine(sb.ToString());
}
catch (Exception ex)
{
Program.Log.Error($"JavaScript泛型序列化错误信息:{ex.ToString()}");
}
} /// <summary>
/// JavaScript泛型的反序列化
/// </summary>
/// <typeparam name="T">泛型类型</typeparam>
/// <param name="path">反序列化的序列化文件路径</param>
/// <returns>泛型对象</returns>
public T JavaScriptDeserialize<T>(string path) where T : class
{
T t = null;
try
{
//string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "test.txt");
string input = Encoding.UTF8.GetString(File.ReadAllBytes(path));
JavaScriptSerializer jss = new JavaScriptSerializer();
if (jss.Deserialize<T>(input) is T a)
{
t = a;
}
}
catch (Exception ex)
{
Program.Log.Error($"JavaScript泛型的反序列化错误信息:{ex.ToString()}");
}
return t;
}
}
}

控制台程序主方法Main测试调用方式如下:

        static void Main(string[] args)
{
#region MyRegion
try
{
TestClass testClass = new TestClass { Id = , Name = "张三", Age = , Address = "上海浦东新区2弄5汤", Sex = "男" };
#region DataContractJsonSerialize 要序列化的对象可以不添加SerializableAttribute属性,[Serializable]
//string s = SerializeManager.Instance.DataContractJsonSerialize<TestClass>(testClass);//序列化
//Console.ForegroundColor = ConsoleColor.Green;
//Console.WriteLine("测试序列化成功。。。");
//Console.WriteLine($"测试序列化结果:{s}"); //string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "序列化123.txt");//序列化
//SerializeManager.Instance.DataContractJsonSerialize<TestClass>(testClass, path); //string json = "{\"Address\":\"中国南京\",\"Age\":10,\"Id\":1,\"Name\":\"张三\",\"Sex\":\"男\"}";
//TestClass test = SerializeManager.Instance.DataContractJsonDeserializeJson<TestClass>(json);//反序列化
//if (test != null)
//{
// Console.WriteLine($"测试序列化结果:{test.ToString()}");
//} //string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "序列化123.txt");
//TestClass test = SerializeManager.Instance.DataContractJsonDeserialize<TestClass>(path);//反序列化
//if (test != null)
//{
// Console.WriteLine($"测试序列化结果:{test.ToString()}");
//}
#endregion #region XmlSerialize 要序列化的对象可以不添加SerializableAttribute属性,[Serializable]
//string s = SerializeManager.Instance.XmlSerialize<TestClass>(testClass);//序列化
//Console.ForegroundColor = ConsoleColor.Green;
//Console.WriteLine("测试序列化成功。。。");
//Console.WriteLine($"测试序列化结果:\r\n{s}"); //string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "序列化.txt");//序列化
//SerializeManager.Instance.XmlSerialize<TestClass>(testClass, path); //备用
//string json = "{\"Address\":\"中国南京\",\"Age\":10,\"Id\":1,\"Name\":\"张三\",\"Sex\":\"男\"}";
//TestClass test = SerializeManager.Instance.DataContractJsonDeserializeJson<TestClass>(json);//反序列化
//if (test != null)
//{
// Console.WriteLine($"测试序列化结果:{test.ToString()}");
//} //string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "序列化.txt");
//TestClass test = SerializeManager.Instance.XmlDeserialize<TestClass>(path);//反序列化
//if (test != null)
//{
// Console.WriteLine($"测试序列化结果:{test.ToString()}");
//}
#endregion TestClass1 testClass1 = new TestClass1 { Id = , Name = "张三11111", Age = , Address = "12123上海浦东新区2弄5汤1111", Sex = "男" };
#region BinarySerialize 必须添可序列化属性,即要序列化的对象必须添加SerializableAttribute属性,[Serializable]
//string s = SerializeManager.Instance.BinarySerialize<TestClass1>(testClass1);//序列化
//Console.ForegroundColor = ConsoleColor.Green;
//Console.WriteLine("测试序列化成功。。。");
//Console.WriteLine($"测试序列化结果:\r\n{s}"); //string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "序列化11111.txt");//序列化
//SerializeManager.Instance.BinarySerialize<TestClass1>(testClass1, path); //备用
//string json = "{\"Address\":\"中国南京\",\"Age\":10,\"Id\":1,\"Name\":\"张三\",\"Sex\":\"男\"}";
//TestClass test = SerializeManager.Instance.DataContractJsonDeserializeJson<TestClass>(json);//反序列化
//if (test != null)
//{
// Console.WriteLine($"测试序列化结果:{test.ToString()}");
//} //string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "序列化11111.txt");
//TestClass1 test = SerializeManager.Instance.BinaryDeserialize<TestClass1>(path);//反序列化
//if (test != null)
//{
// Console.WriteLine($"测试序列化结果:{test.ToString()}");
//}
#endregion #region SoapSerialize 必须添可序列化属性,即要序列化的对象必须添加SerializableAttribute属性,[Serializable]
//string s = SerializeManager.Instance.SoapSerialize<TestClass1>(testClass1);//序列化
//Console.ForegroundColor = ConsoleColor.Green;
//Console.WriteLine("测试序列化成功。。。");
//Console.WriteLine($"测试序列化结果:\r\n{s}"); //string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "序列化2222.txt");//序列化
//SerializeManager.Instance.SoapSerialize<TestClass1>(testClass1, path); //备用
//string json = "{\"Address\":\"中国南京\",\"Age\":10,\"Id\":1,\"Name\":\"张三\",\"Sex\":\"男\"}";
//TestClass test = SerializeManager.Instance.DataContractJsonDeserializeJson<TestClass>(json);//反序列化
//if (test != null)
//{
// Console.WriteLine($"测试序列化结果:{test.ToString()}");
//} //string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "序列化2222.txt");
//TestClass1 test = SerializeManager.Instance.SoapDeserialize<TestClass1>(path);//反序列化
//if (test != null)
//{
// Console.WriteLine($"测试序列化结果:{test.ToString()}");
//}
#endregion #region JavaScriptSerialize 要序列化的对象可以不添加SerializableAttribute属性,[Serializable]
//string s = SerializeManager.Instance.JavaScriptSerialize<TestClass1>(testClass1);//序列化
//Console.ForegroundColor = ConsoleColor.Green;
//Console.WriteLine("测试序列化成功。。。");
//Console.WriteLine($"测试序列化结果:\r\n{s}"); //string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "序列化66666.txt");//序列化
//SerializeManager.Instance.JavaScriptSerialize<TestClass1>(testClass1, path); //备用
//string json = "{\"Address\":\"中国南京\",\"Age\":10,\"Id\":1,\"Name\":\"张三\",\"Sex\":\"男\"}";
//TestClass test = SerializeManager.Instance.DataContractJsonDeserializeJson<TestClass>(json);//反序列化
//if (test != null)
//{
// Console.WriteLine($"测试序列化结果:{test.ToString()}");
//} //string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "序列化66666.txt");
//TestClass1 test = SerializeManager.Instance.JavaScriptDeserialize<TestClass1>(path);//反序列化
//if (test != null)
//{
// Console.WriteLine($"测试序列化结果:{test.ToString()}");
//}
#endregion Console.WriteLine("测试序列化成功。。。");
}
catch (Exception ex)
{
Log.Error($"测试序列化出错,原因:{ex.ToString()}");
throw;
} #endregion Console.ReadLine();
}

使用的类TestClass和TestClass1,类TestClass和TestClass1主要是区分是否添加可序列化属性标记,TestClass主要是测试XmlSerializer(xml序列化)和DatacontractJsonSerializer(json序列化),可以不添加可序列化标记 [Serializable],TestClass1主要是测试Binary和Soap JavaScript序列化,但Binary和Soap JavaScript序列化TestClass1时,必须添加TestClass1的可序列化标记 [Serializable],否则,BinarySerialize,SoapSerialize序列化TestClass1的时候会报,提示未标记可序列化

TestClass类

namespace SupremeConsole
{
/// <summary>
/// 测试类,该类必未标记为可序列化,DataContractJsonSerialize,XmlSerialize可以正常序列化
/// </summary>
public class TestClass
{
/// <summary>
/// 编号
/// </summary>
public int Id { get; set; } /// <summary>
/// 姓名
/// </summary>
public string Name { get; set; } /// <summary>
/// 年龄
/// </summary>
public int Age { get; set; } /// <summary>
/// 地址
/// </summary>
public string Address { get; set; } /// <summary>
/// 性别
/// </summary>
public string Sex { get; set; } public override string ToString()
{
//return string.Format("编号:{0},姓名:{1},年龄:{2},地址:{3},性别:{4}", Id, Name, Age, Address, Sex);
return $"编号:{Id},姓名:{Name},年龄:{Age},地址:{Address},性别:{Sex}";
}
}
}

TestClass1类

using System;
using System.Runtime.Serialization; namespace SupremeConsole
{
/// <summary>
/// 测试类1,该类必须标记可序列化,否则,BinarySerialize,SoapSerialize序列化的时候会报,未标记可序列化
/// </summary>
[Serializable]
[DataContract]
public class TestClass1
{
/// <summary>
/// 编号
/// </summary> public int Id { get; set; } /// <summary>
/// 姓名
/// </summary>
public string Name { get; set; } /// <summary>
/// 年龄
/// </summary>
public int Age { get; set; } /// <summary>
/// 地址
/// </summary>
public string Address { get; set; } /// <summary>
/// 性别
/// </summary>
public string Sex { get; set; } public override string ToString()
{
//return string.Format("编号:{0},姓名:{1},年龄:{2},地址:{3},性别:{4}", Id, Name, Age, Address, Sex);
return $"编号:{Id},姓名:{Name},年龄:{Age},地址:{Address},性别:{Sex}";
}
}
}

C# 序列化与反序列化Serialization之Json Xml Binary Soap JavaScript序列化的更多相关文章

  1. C# 序列化与反序列化之DataContract与xml对子类进行序列化的解决方案

    C# 序列化与反序列化之DataContract与xml对子类进行序列化的解决方案 1.DataContract继承对子类进行序列化的解决方案 第一种是在 [DataContract, KnownTy ...

  2. Json序列化与反序列化(对象与Json字符串的转换)--C#

    public class JsonHelper { #region Json序列化与反序列化 /// <summary> /// 将json转化为对象 /// (需要提前构造好结构一致的M ...

  3. C# dynamic类型序列化和反序列化之Newtonsoft.Json

    原文:C# dynamic类型序列化和反序列化之Newtonsoft.Json 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/u011127019/ ...

  4. 序列化与反序列化 - BinaryFormatter二进制(.dat)、SoapFormatter(.soap)、XmlSerializer(.xml)

    序列化的作用是什么?为什么要序列化? 1.在进程下次启动时读取上次保存的对象的信息. 2.在不同的应用程序域或进程之间传递数据. 3.在分布式应用程序中的各应用程序之间传输对象. 所为序列化,就是将对 ...

  5. c# xml序列化和反序列化。也就是xml的解析和反解析。

    用习惯了newTownSoft.json 的json反序列化.碰到xml是真的不习惯. 每次json反序列化都是直接把json丢到bejson网站生成一个实体类,稍微修改修改一点点变量名.然后直接ne ...

  6. ASP.NET JSON的序列化和反序列化 之 Newtonsoft.Json

    我们用到的类库为:Newtonsoft.Json,通过VS工具中NuGet程序包可以下载. 一:对象转json-序列化 public class Student { public int ID { g ...

  7. C# dynamic类型序列化和反序列化之Newtonsoft.Json,动态解析远端返回的jSON数据

    一.说明 1.Newtonsoft.Json 中的Linq To Json中提供了方便的json数据查询.修改等操作. 例如:JObject,JArray 2.在JObject.FromObject( ...

  8. java中的序列化与反序列化,还包括将多个对象序列化到一个文件中

    package Serialize; /** * Created by hu on 2015/11/7. */ //实现序列化必须实现的接口,这就是一个空接口,起到标识的作用 import java. ...

  9. 解决如下json格式的字符串不能使用DataContractJsonSerializer序列化和反序列化 分类: JSON 2015-01-28 14:26 72人阅读 评论(0) 收藏

    可以解决如下json格式的字符串不能使用DataContractJsonSerializer反序列化 {     "ss": "sss",     " ...

随机推荐

  1. jemeter学习-badboy录制与代理服务器录制

    一 基本元素的介绍 1. 添加测试计划 2.添加线程组 线程数---并发数,模拟多少个用户并发 Ramp-up periods ----我们要在多少秒之内进行多少用户的并发 循环次数---可以选择一次 ...

  2. Miniconda

    什么是conda conda的基本使用方式 conda是一个开源包管理系统和环境管理系统,用于安装多个版本的软件包及其依赖关系,并在它们之间轻松切换. 它适用于Linux,OS X和Windows,是 ...

  3. JMETER 使用BeanShell 配合 if 控制器实现逻辑控制

    业务场景 在登录后,我们根据登录的响应,判断是否执行下一步的操作. 实现步骤 1.在登录采样器树中增加BeanShell 监听器. 作用是在线程上下文变量中增加一个变量,表示登录是否成功. beans ...

  4. springboot 解决 数字长度过长导致JS精度丢失问题

    问题 在开发过程中,我们的主键字段使用了数字作为主键ID,发现数字精度丢失的问题. 上图红框是后端日志的输出. 在浏览器端F12 看到的结果如上图,数据居然自动变化,这个是数字在浏览器丢失了精度,导致 ...

  5. Unity历史版本的文档

    前言 在我们的开发过程中,如果要查找Unity文档,通常会有以下两种方式: 1. 打开Unity的官网,查找文档 2. 查找本地安装的Unity文档 但是Unity官网上的文档,总是当前最新版本的文档 ...

  6. ROS学习(更新中~)

    1.一次把ROS环境变量都自动配置好(即添加到bash会话中)echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc ...

  7. upd

    今天是中华人民共和国成立70周年,先祝我的祖国母亲生日快乐 由于最近嗓子不太好使,我就不发歌了 分割线 在学校挤了一点本来应该发呆的时间写了点没用的 前一部分是对一点OI知识的复习,后一部分是最近高中 ...

  8. 【Centos】桌面安装(转)

    链接:https://www.bnxb.com/linuxserver/27457.html 正常我们在使用CENTOS时候都是不会去用到它的GUI桌面系统,都是用最基础的命令行形式,这样会比较节省服 ...

  9. Opencv 初探 常用API

    一.介绍 OpenCV是计算机视觉领域应用最广泛的开源工具包,基于C/C++,支持Linux/Windows/MacOS/Android/iOS,并提供了Python,Matlab和Java等语言的接 ...

  10. combineReducers(reducers)

    combineReducers(reducers) 随着应用变得越来越复杂,可以考虑将 reducer 函数 拆分成多个单独的函数,拆分后的每个函数负责独立管理 state 的一部分. combine ...