FastBinaryFormatterSerializeT(ByteBlock, T, FastSerializerContext) 方法
将对象序列化到字节块中。
命名空间: TouchSocket.Core程序集: TouchSocket.Core (在 TouchSocket.Core.dll 中) 版本:4.1.4.7+7f7e1f78093c99347956e09330d5d7aca1d2bdf2
public static void Serialize<T>(
ByteBlock byteBlock,
in T graph,
FastSerializerContext serializerContext = null
)
Public Shared Sub Serialize(Of T) (
byteBlock As ByteBlock,
ByRef graph As T,
Optional serializerContext As FastSerializerContext = Nothing
)
static member Serialize :
byteBlock : ByteBlock *
graph : 'T byref *
?serializerContext : FastSerializerContext
(* Defaults:
let _serializerContext = defaultArg serializerContext null
*)
-> unit
- byteBlock ByteBlock
- 目标ByteBlock。
- graph T
- 要序列化的对象实例。
- serializerContext FastSerializerContext (Optional)
- 序列化上下文,为 时使用默认上下文。
- T
- 要序列化的对象类型。
此方法会在序列化数据前写入魔数(协议头),用于反序列化时的校验。