c#各类型转byte[]或转回

var tmp = BitConverter.ToInt32(new byte[]{...});
var bytes = BitConverter.GetBytes(tmp);

而String转byte[]和转回要用Encoding。

原文地址:https://www.cnblogs.com/hont/p/4273017.html