Skip to content

Commit a4bd1c7

Browse files
author
Ron Petrusha
committed
Incorporated reveiw comments
1 parent a3c2b31 commit a4bd1c7

File tree

3 files changed

+17
-19
lines changed

3 files changed

+17
-19
lines changed

xml/System.Buffers/IMemoryOwner`1.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<remarks>
2424
<format type="text/markdown"><![CDATA[
2525
26-
The `IMemoryOwner<T>` interface is used to define the owner responsible for the lifetime management of a <xref:System.Memory%601> buffer. An instance of the `IMemoryOwner<T>` interface is returned by the <xref:System.Buffers.ArrayPool%601.Rent%2A?displayProperty=nameWithType> and <xef:System.Buffers.MemoryPool%601.Rent%2A?displayProperty=nameWithType> methods.
26+
The `IMemoryOwner<T>` interface is used to define the owner responsible for the lifetime management of a <xref:System.Memory%601> buffer. An instance of the `IMemoryOwner<T>` interface is returned by the <xref:System.Buffers.MemoryPool%601.Rent%2A?displayProperty=nameWithType> methods.
2727
2828
While a buffer can have multiple consumers, it can only have a single owner at any given time. The owner can:
2929
@@ -33,6 +33,8 @@ While a buffer can have multiple consumers, it can only have a single owner at a
3333
3434
- Destroy the buffer when it is no longer in use.
3535
36+
Because the `IMemoryOwner<T>` object implements the <xref:System.IDisposable> interface, you should call its <xref:System.IDisposable.Dispose%2A> method only after the memory buffer is no longer needed and you have destroyed it. You should *not* dispose of the `IMemoryOnwer<T>` object while a reference to its memory is available. This means that the type in which `IMemoryOwner<T>` is declared should not have a <xref:System.Object.Finalize%2A> method.
37+
3638
]]></format>
3739

3840
</remarks>

xml/System/Memory`1.xml

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,14 @@
2929
3030
## Remarks
3131
32-
Like <xref:System.Span%601>, `Memory<T>` represents a contiguous region of memory. Unlike <xref:System.Span%601>, however, `Memory<T>` is not a [ref struct](~/doocs/csharp/reference-semantics-with-value-types?view=netcore-2.1.md#ref-struct-type). This means that `Memory<T>` can be backed by:
33-
34-
- An array.
35-
- A string (a sequence of characters).
36-
- A <xref:System.Runtime.InteropServices.SafeHandle>.
37-
38-
`Memory<T>` cannot be backed by transient unmanaged memory, such as memory available by using [stackalloc](~/docs/csharp/language-reference/keywords/stackalloc.md).
39-
40-
Because the memory allocated to the `Memory<T>` structure is placed on the managed heap, it does not have the same restrictions as a <xref:System.Span%601> instance. In particular:
32+
Like <xref:System.Span%601>, `Memory<T>` represents a contiguous region of memory. Unlike <xref:System.Span%601>, however, `Memory<T>` is not a [ref struct](~/doocs/csharp/reference-semantics-with-value-types?view=netcore-2.1.md#ref-struct-type). This means that `Memory<T>` can be placed on the managed heap, whereas <xref:System.Span%601> cannot. As a result, the `Memory<T>` structure does not have the same restrictions as a <xref:System.Span%601> instance. In particular:
4133
4234
- It can be used as a field in a class.
4335
4436
- It can be used across `await` and `yield` boundaries.
4537
4638
In addition to `Memory<T>`, you can use <xref:System.ReadOnlyMemory%601?displayProperty=nameWithType> to represent immutable or read-only memory.
4739
48-
### Memory<T> basics
49-
50-
5140
]]></format>
5241
</remarks>
5342
</Docs>
@@ -73,12 +62,17 @@ In addition to `Memory<T>`, you can use <xref:System.ReadOnlyMemory%601?displayP
7362
<remarks>
7463
<format type="text/markdown"><![CDATA[
7564
76-
If `array` is `null`, this constructor returns a `null` <xref:System.Memory%601> object.
65+
If `array` is `null`, this constructor returns a <xref:System.Memory%601> object with a `default<T>` value.
7766
7867
]]></format>
7968
</remarks>
8069
<exception cref="T:System.ArrayTypeMismatchException">
81-
<paramref name="T" /> is a reference type, and <paramref name="array" /> is not an array of type <paramref name="T" />.</exception>
70+
<paramref name="T" /> is a reference type, and <paramref name="array" /> is not an array of type <paramref name="T" />.
71+
72+
-or-
73+
74+
The array is <see href="~/docs/csharp/programming-guide/concepts/covariance-contravariance/index.md" />covariant.</see>
75+
</exception>
8276
</Docs>
8377
</Member>
8478
<Member MemberName=".ctor">
@@ -106,7 +100,7 @@ If `array` is `null`, this constructor returns a `null` <xref:System.Memory%601>
106100
<remarks>
107101
<format type="text/markdown"><![CDATA[
108102
109-
If `array` is `null`, this constructor returns a `null` <xref:System.Memory%601> object.
103+
If `array` is `null`, this constructor returns a <xref:System.Memory%601> object with a `default<T>` value.
110104
111105
]]></format>
112106
</remarks>
@@ -201,7 +195,9 @@ The two objects are equal if:
201195
- `other` is a <xref:System.Memory%601> or <xref:System.ReadOnlyMemory%601> object.
202196
203197
- Both objects point to the same array and have the same length.
204-
198+
199+
The `Equals(Memory<T>)` method performs a test for reference equality; it does not compare the elements of <xref:Memory%601> for equality.
200+
205201
]]></format>
206202
</remarks>
207203
</Docs>
@@ -470,7 +466,7 @@ The garbage collector will not move the memory until the returned <xref:T:System
470466
<param name="start">The index at which to begin the slice.</param>
471467
<param name="length">The number of elements to include in the slice.</param>
472468
<summary>Forms a slice out of the current memory starting at a specified index for a specified length.</summary>
473-
<returns>An object that <paramref name="length" /> elements from the current instance starting at <paramref name="start" />. </returns>
469+
<returns>An object that contains <paramref name="length" /> elements from the current instance starting at <paramref name="start" />. </returns>
474470
<remarks>To be added.</remarks>
475471
<exception cref="T:System.ArgumentOutOfRangeExceptionException"><paramref name="start" /> is less than zero or greater than or equal to <see cref="P:Memory`1.Length" />.
476472

xml/System/Span`1.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ The following example creates a slice of the middle five elements of a 10-elemen
6969
7070
## Span\<T> and slices
7171
72-
`Span\<T>` includes two overloads of the <xref:System.Span%601.Slice%2A> method that forms a slice out of the current span that starts at a specified index. This makes it possible to treat the data in a `Span\<T>` as a set of logical chunks that can be processed as needed by portions of a data processing pipeline with minimal performance impact. For example, since modern server protocols are often text-based, manipulation of strings and substrings is particularly important. In the <xref:System.String> class, the major method for extracting substrings is <xref:System.String.Substring%2A>. For data pipelines that rely on extensive string manipulation, it use offers some performance penalties, since it:
72+
`Span\<T>` includes two overloads of the <xref:System.Span%601.Slice%2A> method that forms a slice out of the current span that starts at a specified index. This makes it possible to treat the data in a `Span\<T>` as a set of logical chunks that can be processed as needed by portions of a data processing pipeline with minimal performance impact. For example, since modern server protocols are often text-based, manipulation of strings and substrings is particularly important. In the <xref:System.String> class, the major method for extracting substrings is <xref:System.String.Substring%2A>. For data pipelines that rely on extensive string manipulation, its use offers some performance penalties, since it:
7373
7474
1. Creates a new string to hold the substring.
7575

0 commit comments

Comments
 (0)