ReadOnlyMemory<T>.TryCopyTo(Memory<T>) ReadOnlyMemory<T>.TryCopyTo(Memory<T>) ReadOnlyMemory<T>.TryCopyTo(Memory<T>) ReadOnlyMemory<T>.TryCopyTo(Memory<T>) Method

定义

尝试将只读内存的内容复制到目标中,并返回表示复制操作是否成功的值。Tries to copy the contents of the readonly-only memory into the destination and returns a value that indicates whether the copy operation succeeded.

public:
 bool TryCopyTo(Memory<T> destination);
public bool TryCopyTo (Memory<T> destination);
member this.TryCopyTo : Memory<'T> -> bool
Public Function TryCopyTo (destination As Memory(Of T)) As Boolean

参数

destination
Memory<T> Memory<T> Memory<T> Memory<T>

要将项复制到其中的内存区域。The memory region to copy items into.

返回

如果复制操作成功,则为 truetrue if the copy operation succeeded. 如果 destination 小于当前实例且没有数据写入到 destination,则为 falsefalse if destination is smaller than the current instance, and no data is written to destination.

注解

如果源和目标重叠, 则此方法的行为就像原始值位于临时位置, 然后覆盖目标。If the source and destination overlap, this method behaves as if the original values are in a temporary location before the destination is overwritten.

适用于