Skip to content

Commit 7ab0f22

Browse files
author
Ron Petrusha
committed
Incorporated reveiw comments
1 parent 0ac6065 commit 7ab0f22

File tree

3 files changed

+16
-23
lines changed

3 files changed

+16
-23
lines changed

xml/System.Buffers/IMemoryOwner`1.xml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ While a buffer can have multiple consumers, it can only have a single owner at a
3636
3737
- Destroy the buffer when it is no longer in use.
3838
39+
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.
40+
3941
]]></format>
4042

4143
</remarks>
@@ -60,13 +62,8 @@ While a buffer can have multiple consumers, it can only have a single owner at a
6062
<ReturnType>System.Memory&lt;T&gt;</ReturnType>
6163
</ReturnValue>
6264
<Docs>
63-
<<<<<<< HEAD
64-
<summary>Gets the associated <see cref="System.Memory`1" /> buffer.</summary>
65-
<value>The associated <see cref="System.Memory`1" /> buffer.</value>
66-
=======
6765
<summary>Gets the memory belonging to this owner.</summary>
6866
<value>The memory belonging to this owner.</value>
69-
>>>>>>> Incremental commit
7067
<remarks>To be added.</remarks>
7168
</Docs>
7269
</Member>

xml/System/Memory`1.xml

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,14 @@
3232
3333
## Remarks
3434
35-
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:
36-
37-
- An array.
38-
- A string (a sequence of characters).
39-
- A <xref:System.Runtime.InteropServices.SafeHandle>.
40-
41-
`Memory<T>` cannot be backed by transient unmanaged memory, such as memory available by using [stackalloc](~/docs/csharp/language-reference/keywords/stackalloc.md).
42-
43-
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:
35+
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:
4436
4537
- It can be used as a field in a class.
4638
4739
- It can be used across `await` and `yield` boundaries.
4840
4941
In addition to `Memory<T>`, you can use <xref:System.ReadOnlyMemory%601?displayProperty=nameWithType> to represent immutable or read-only memory.
5042
51-
### Memory<T> basics
52-
53-
5443
]]></format>
5544
</remarks>
5645
</Docs>
@@ -79,12 +68,17 @@ In addition to `Memory<T>`, you can use <xref:System.ReadOnlyMemory%601?displayP
7968
<remarks>
8069
<format type="text/markdown"><![CDATA[
8170
82-
If `array` is `null`, this constructor returns a `null` <xref:System.Memory%601> object.
71+
If `array` is `null`, this constructor returns a <xref:System.Memory%601> object with a `default<T>` value.
8372
8473
]]></format>
8574
</remarks>
8675
<exception cref="T:System.ArrayTypeMismatchException">
87-
<paramref name="T" /> is a reference type, and <paramref name="array" /> is not an array of type <paramref name="T" />.</exception>
76+
<paramref name="T" /> is a reference type, and <paramref name="array" /> is not an array of type <paramref name="T" />.
77+
78+
-or-
79+
80+
The array is <see href="~/docs/csharp/programming-guide/concepts/covariance-contravariance/index.md" />covariant.</see>
81+
</exception>
8882
</Docs>
8983
</Member>
9084
<Member MemberName=".ctor">
@@ -115,7 +109,7 @@ If `array` is `null`, this constructor returns a `null` <xref:System.Memory%601>
115109
<remarks>
116110
<format type="text/markdown"><![CDATA[
117111
118-
If `array` is `null`, this constructor returns a `null` <xref:System.Memory%601> object.
112+
If `array` is `null`, this constructor returns a <xref:System.Memory%601> object with a `default<T>` value.
119113
120114
]]></format>
121115
</remarks>
@@ -219,7 +213,9 @@ The two objects are equal if:
219213
- `other` is a <xref:System.Memory%601> or <xref:System.ReadOnlyMemory%601> object.
220214
221215
- Both objects point to the same array and have the same length.
222-
216+
217+
The `Equals(Memory<T>)` method performs a test for reference equality; it does not compare the elements of <xref:Memory%601> for equality.
218+
223219
]]></format>
224220
</remarks>
225221
</Docs>
@@ -518,7 +514,7 @@ The garbage collector will not move the memory until the returned <xref:T:System
518514
<param name="start">The index at which to begin the slice.</param>
519515
<param name="length">The number of elements to include in the slice.</param>
520516
<summary>Forms a slice out of the current memory starting at a specified index for a specified length.</summary>
521-
<returns>An object that <paramref name="length" /> elements from the current instance starting at <paramref name="start" />. </returns>
517+
<returns>An object that contains <paramref name="length" /> elements from the current instance starting at <paramref name="start" />. </returns>
522518
<remarks>To be added.</remarks>
523519
<exception cref="T:System.ArgumentOutOfRangeExceptionException"><paramref name="start" /> is less than zero or greater than or equal to <see cref="P:Memory`1.Length" />.
524520

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)