Class MemoryExtensions
Extensions to System.Memory types, such as Span<T> and ReadOnlySpan<T>.
Inherited Members
Namespace: Lucene.Net
Assembly: Lucene.Net.dll
Syntax
public static class MemoryExtensions
Methods
AsMemory(ICharTermAttribute)
Creates a new ReadOnlyMemory<T> over the portion of the target string.
Declaration
public static ReadOnlyMemory<char> AsMemory(this ICharTermAttribute text)
Parameters
| Type | Name | Description |
|---|---|---|
| ICharTermAttribute | text | The target string. |
Returns
| Type | Description |
|---|---|
| ReadOnlyMemory<char> | The read-only character memory representation of the string, or |
Remarks
Returns default when text is null.
AsMemory(ICharTermAttribute, Index)
Creates a new ReadOnlyMemory<T> over the portion of the target string.
Declaration
public static ReadOnlyMemory<char> AsMemory(this ICharTermAttribute text, Index startIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| ICharTermAttribute | text | The target string. |
| Index | startIndex | The index at which to begin this slice. |
Returns
| Type | Description |
|---|---|
| ReadOnlyMemory<char> | The read-only character memory representation of the string. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentOutOfRangeException |
|
AsMemory(ICharTermAttribute, int)
Creates a new ReadOnlyMemory<T> over the portion of the target string.
Declaration
public static ReadOnlyMemory<char> AsMemory(this ICharTermAttribute text, int start)
Parameters
| Type | Name | Description |
|---|---|---|
| ICharTermAttribute | text | The target string. |
| int | start | The index at which to begin this slice. |
Returns
| Type | Description |
|---|---|
| ReadOnlyMemory<char> | Returns default when |
Remarks
Returns default when text is null.
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException |
|
AsMemory(ICharTermAttribute, int, int)
Creates a new ReadOnlyMemory<T> over the portion of the target string.
Declaration
public static ReadOnlyMemory<char> AsMemory(this ICharTermAttribute text, int start, int length)
Parameters
| Type | Name | Description |
|---|---|---|
| ICharTermAttribute | text | The target string. |
| int | start | The index at which to begin this slice. |
| int | length | The desired length for the slice (exclusive). |
Returns
| Type | Description |
|---|---|
| ReadOnlyMemory<char> | The read-only character memory representation of the string, or |
Remarks
Returns default when text is null.
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException |
|
AsMemory(ICharTermAttribute, Range)
Creates a new ReadOnlyMemory<T> over the portion of the target string.
Declaration
public static ReadOnlyMemory<char> AsMemory(this ICharTermAttribute text, Range range)
Parameters
| Type | Name | Description |
|---|---|---|
| ICharTermAttribute | text | The target string. |
| Range | range | The range used to indicate the start and length of the sliced string. |
Returns
| Type | Description |
|---|---|
| ReadOnlyMemory<char> | The read-only character memory representation of the string. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentOutOfRangeException |
|
AsSpan(ICharTermAttribute)
Creates a new readonly span over the portion of the target string.
Declaration
public static ReadOnlySpan<char> AsSpan(this ICharTermAttribute text)
Parameters
| Type | Name | Description |
|---|---|---|
| ICharTermAttribute | text | The target string. |
Returns
| Type | Description |
|---|---|
| ReadOnlySpan<char> | The read-only span representation of the string. |
Remarks
Returns default when text is null.
AsSpan(ICharTermAttribute, Index)
Creates a new read-only span over a portion of the target string from a specified position to the end of the string.
Declaration
public static ReadOnlySpan<char> AsSpan(this ICharTermAttribute text, Index startIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| ICharTermAttribute | text | The target string. |
| Index | startIndex | The index at which to begin this slice. |
Returns
| Type | Description |
|---|---|
| ReadOnlySpan<char> | The read-only span representation of the string. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentOutOfRangeException |
|
AsSpan(ICharTermAttribute, int)
Creates a new read-only span over a portion of the target string from a specified position to the end of the string.
Declaration
public static ReadOnlySpan<char> AsSpan(this ICharTermAttribute text, int start)
Parameters
| Type | Name | Description |
|---|---|---|
| ICharTermAttribute | text | The target string. |
| int | start | The index at which to begin this slice. |
Returns
| Type | Description |
|---|---|
| ReadOnlySpan<char> | The read-only span representation of the string. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException |
|
| ArgumentNullException |
|
AsSpan(ICharTermAttribute, int, int)
Creates a new read-only span over a portion of the target string from a specified position for a specified number of characters.
Declaration
public static ReadOnlySpan<char> AsSpan(this ICharTermAttribute text, int start, int length)
Parameters
| Type | Name | Description |
|---|---|---|
| ICharTermAttribute | text | The target string. |
| int | start | The index at which to begin this slice. |
| int | length | The desired length for the slice. |
Returns
| Type | Description |
|---|---|
| ReadOnlySpan<char> | The read-only span representation of the string. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException |
|
AsSpan(ICharTermAttribute, Range)
Creates a new read-only span over a portion of a target string using the range start and end indexes.
Declaration
public static ReadOnlySpan<char> AsSpan(this ICharTermAttribute text, Range range)
Parameters
| Type | Name | Description |
|---|---|---|
| ICharTermAttribute | text | The target string. |
| Range | range | The range that has start and end indexes to use for slicing the string. |
Returns
| Type | Description |
|---|---|
| ReadOnlySpan<char> | The read-only span representation of the string. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentOutOfRangeException |
|