一款简单易用的基础网络通讯组件库。

ContiguousMemoryBuffer 结构

表示一个连续内存缓冲区,用于将ReadOnlySequenceT转换为连续的内存块。 实现了IDisposable接口以支持资源释放。

Definition

命名空间: TouchSocket.Core
程序集: TouchSocket.Core (在 TouchSocket.Core.dll 中) 版本:4.0.0-beta.143+5fcca7a4e70968794985dc3793adc50531308be6
C#
public struct ContiguousMemoryBuffer : IDisposable
Inheritance
Object    ValueType    ContiguousMemoryBuffer
Implements
IDisposable

备注

此结构体用于优化多段序列内存的访问性能。如果输入序列已经是单段内存,则直接使用原始内存; 如果是多段内存,则从内存池中租用缓冲区并将所有段复制到连续内存中。 使用后应调用Dispose方法释放可能租用的内存资源。

构造函数

ContiguousMemoryBuffer 使用指定的只读字节序列初始化ContiguousMemoryBuffer的新实例。

属性

IsRentedFromPool 获取一个值,该值指示是否从内存池租用了新缓冲区。
Memory 获取连续的内存块。

方法

DisposePerforms application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
EqualsIndicates whether this instance and a specified object are equal.
(继承自 ValueType。)
GetHashCodeReturns the hash code for this instance.
(继承自 ValueType。)
GetTypeGets the Type of the current instance.
(继承自 Object。)
ToStringReturns the fully qualified type name of this instance.
(继承自 ValueType。)

扩展方法

Map 将源对象的属性映射到目标对象的属性中。
(由 Mapper 定义。)
Map 将源对象映射到目标类型的实例。
(由 Mapper 定义。)
MapTTarget 将源对象映射到指定目标类型的新实例。
(由 Mapper 定义。)
SafeDispose 安全性释放(不用判断对象是否为空)。不会抛出任何异常。
(由 SystemExtension 定义。)
ToJsonString 转换为Json
(由 SerializeConvert 定义。)

参见