diff --git a/docs/standard/memory-and-spans/memory-t-usage-guidelines.md b/docs/standard/memory-and-spans/memory-t-usage-guidelines.md index 4d6f503d5ef54..8cd600197a5b7 100644 --- a/docs/standard/memory-and-spans/memory-t-usage-guidelines.md +++ b/docs/standard/memory-and-spans/memory-t-usage-guidelines.md @@ -1,7 +1,7 @@ --- title: "Memory and Span usage guidelines" description: This article describes Memory and Span, which are buffers of structured data in .NET Core that can be used in pipelines. -ms.date: "10/01/2018" +ms.date: 02/05/2021 helpviewer_keywords: - "Memory<T> and Span<T> best practices" - "using Memory<T> and Span<T>" @@ -22,7 +22,7 @@ Since buffers can be passed around between APIs, and since buffers can sometimes - **Lease**. The lease is the length of time that a particular component is allowed to be the consumer of the buffer. -The following pseudo-code example illustrates these three concepts. It includes a `Main` method that instantiates a buffer of type , calls the `WriteInt32ToBuffer` method to write the string representation of an integer to the buffer, and then calls the `DisplayBufferToConsole` method to display the value of the buffer. +The following pseudo-code example illustrates these three concepts. `Buffer` in the pseudo-code represents a or buffer of type . The `Main` method instantiates the buffer, calls the `WriteInt32ToBuffer` method to write the string representation of an integer to the buffer, and then calls the `DisplayBufferToConsole` method to display the value of the buffer. ```csharp using System; @@ -53,7 +53,7 @@ class Program } ``` -The `Main` method creates the buffer (in this case an instance) and so is its owner. Therefore, `Main` is responsible for destroying the buffer when it's no longer in use. It does this by calling the buffer's method. (The method here actually clears the buffer's memory; the structure doesn't actually have a method that destroys the buffer.) +The `Main` method creates the buffer and so is its owner. Therefore, `Main` is responsible for destroying the buffer when it's no longer in use. The pseudo-code illustrates this by calling a `Destroy` method on the buffer. (Neither nor actually has a `Destroy` method. You'll see actual code examples later in this article.) The buffer has two consumers, `WriteInt32ToBuffer` and `DisplayBufferToConsole`. There is only one consumer at a time (first `WriteInt32ToBuffer`, then `DisplayBufferToConsole`), and neither of the consumers owns the buffer. Note also that "consumer" in this context doesn't imply a read-only view of the buffer; consumers can modify the buffer's contents, as `WriteInt32ToBuffer` does, if given a read/write view of the buffer.