MemoryExtensions.AsSpan 方法   
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
| AsSpan(String, Int32, Int32) | 
						 从指定字符数量的指定位置在目标字符串的一部分上创建新的只读跨度。  | 
        	
| AsSpan(String, Range) | 
						 使用范围起始索引和结束索引在目标字符串的一部分上创建新的 ReadOnlySpan<T> 。  | 
        	
| AsSpan(String, Int32) | 
						 从指定位置到字符串结尾,在目标字符串的一部分上创建新的只读跨度。  | 
        	
| AsSpan(String, Index) | 
						 在目标字符串的一部分上从指定位置到字符串末尾创建一个新的 ReadOnlySpan<T> 。  | 
        	
| AsSpan(String) | 
						 在字符串上创建新的只读跨度。  | 
        	
| AsSpan<T>(ArraySegment<T>) | 
						 在目标数组段上创建新的跨度。  | 
        	
| AsSpan<T>(T[]) | 
						 在目标数组上创建新的跨度。  | 
        	
| AsSpan<T>(ArraySegment<T>, Index) | 
						 在目标数组段的一部分上创建新的跨度,从指定的索引开始,以段的末尾结束。  | 
        	
| AsSpan<T>(ArraySegment<T>, Int32) | 
						 从指定位置到段的结尾,在目标数组段的一部分上创建新的跨度。  | 
        	
| AsSpan<T>(ArraySegment<T>, Range) | 
						 使用范围起始和结束索引在目标数组段的一部分上创建新的跨度。  | 
        	
| AsSpan<T>(T[], Index) | 
						 在由 Index 值定义的目标数组部分上创建新的跨度。  | 
        	
| AsSpan<T>(T[], Int32) | 
						 从指定位置开始到数组的结尾,在目标数组的一部分上创建一个新的跨度。  | 
        	
| AsSpan<T>(T[], Range) | 
						 在由 Range 值定义的目标数组部分上创建新的跨度。  | 
        	
| AsSpan<T>(ArraySegment<T>, Int32, Int32) | 
						 从指定长度的指定位置在目标数组段的一部分上创建新的跨度。  | 
        	
| AsSpan<T>(T[], Int32, Int32) | 
						 从指定长度的指定位置在目标数组的一部分上创建新的跨度。  | 
        	
AsSpan(String, Int32, Int32)
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
从指定字符数量的指定位置在目标字符串的一部分上创建新的只读跨度。
public:
[System::Runtime::CompilerServices::Extension]
 static ReadOnlySpan<char> AsSpan(System::String ^ text, int start, int length);
	public static ReadOnlySpan<char> AsSpan (this string? text, int start, int length);
	public static ReadOnlySpan<char> AsSpan (this string text, int start, int length);
	static member AsSpan : string * int * int -> ReadOnlySpan<char>
	<Extension()>
Public Function AsSpan (text As String, start As Integer, length As Integer) As ReadOnlySpan(Of Char)
	参数
- text
 - String
 
目标字符串。
- start
 - Int32
 
开始切片处的索引。
- length
 - Int32
 
切片所需的长度。
返回
字符串的只读跨度表示形式。
例外
              start、length 或 start + length 不在 text 的范围内。
注解
当 为 null时text返回 default 。
适用于
AsSpan(String, Range)
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
使用范围起始索引和结束索引在目标字符串的一部分上创建新的 ReadOnlySpan<T> 。
public:
[System::Runtime::CompilerServices::Extension]
 static ReadOnlySpan<char> AsSpan(System::String ^ text, Range range);
	public static ReadOnlySpan<char> AsSpan (this string? text, Range range);
	static member AsSpan : string * Range -> ReadOnlySpan<char>
	<Extension()>
Public Function AsSpan (text As String, range As Range) As ReadOnlySpan(Of Char)
	参数
- text
 - String
 
目标字符串。
- range
 - Range
 
具有开始索引和结束索引的区域,用于对字符串进行切片。
返回
例外
              text 为 null。
              range的开始或结束索引不在字符串的边界内。
              range的开始索引大于其结束索引。
适用于
AsSpan(String, Int32)
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
从指定位置到字符串结尾,在目标字符串的一部分上创建新的只读跨度。
public:
[System::Runtime::CompilerServices::Extension]
 static ReadOnlySpan<char> AsSpan(System::String ^ text, int start);
	public static ReadOnlySpan<char> AsSpan (this string? text, int start);
	public static ReadOnlySpan<char> AsSpan (this string text, int start);
	static member AsSpan : string * int -> ReadOnlySpan<char>
	<Extension()>
Public Function AsSpan (text As String, start As Integer) As ReadOnlySpan(Of Char)
	参数
- text
 - String
 
目标字符串。
- start
 - Int32
 
开始切片处的索引。
返回
字符串的只读跨度表示形式。
例外
              start 小于 0 或大于 text.Length。
当 text 为 null 时,将引发此异常。
适用于
AsSpan(String, Index)
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
在目标字符串的一部分上从指定位置到字符串末尾创建一个新的 ReadOnlySpan<T> 。
public:
[System::Runtime::CompilerServices::Extension]
 static ReadOnlySpan<char> AsSpan(System::String ^ text, Index startIndex);
	public static ReadOnlySpan<char> AsSpan (this string? text, Index startIndex);
	static member AsSpan : string * Index -> ReadOnlySpan<char>
	<Extension()>
Public Function AsSpan (text As String, startIndex As Index) As ReadOnlySpan(Of Char)
	参数
- text
 - String
 
目标字符串。
- startIndex
 - Index
 
开始切片处的索引。
返回
例外
              startIndex 小于 0 或大于 text。长度。
适用于
AsSpan(String)
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
在字符串上创建新的只读跨度。
public:
[System::Runtime::CompilerServices::Extension]
 static ReadOnlySpan<char> AsSpan(System::String ^ text);
	public static ReadOnlySpan<char> AsSpan (this string? text);
	public static ReadOnlySpan<char> AsSpan (this string text);
	static member AsSpan : string -> ReadOnlySpan<char>
	<Extension()>
Public Function AsSpan (text As String) As ReadOnlySpan(Of Char)
	参数
- text
 - String
 
目标字符串。
返回
字符串的只读跨度表示形式。
注解
当 为 null时text返回 default 。
适用于
AsSpan<T>(ArraySegment<T>)
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
在目标数组段上创建新的跨度。
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static Span<T> AsSpan(ArraySegment<T> segment);
	public static Span<T> AsSpan<T> (this ArraySegment<T> segment);
	static member AsSpan : ArraySegment<'T> -> Span<'T>
	<Extension()>
Public Function AsSpan(Of T) (segment As ArraySegment(Of T)) As Span(Of T)
    类型参数
- T
 
数组段的类型。
参数
- segment
 - ArraySegment<T>
 
要写入的数组段。
返回
数组段的跨度表示形式。
适用于
AsSpan<T>(T[])
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
在目标数组上创建新的跨度。
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static Span<T> AsSpan(cli::array <T> ^ array);
	public static Span<T> AsSpan<T> (this T[]? array);
	public static Span<T> AsSpan<T> (this T[] array);
	static member AsSpan : 'T[] -> Span<'T>
	<Extension()>
Public Function AsSpan(Of T) (array As T()) As Span(Of T)
    类型参数
- T
 
数组的类型。
参数
- array
 - T[]
 
要转换的数组。
返回
数组的跨度表示形式。
适用于
AsSpan<T>(ArraySegment<T>, Index)
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
在目标数组段的一部分上创建新的跨度,从指定的索引开始,以段的末尾结束。
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static Span<T> AsSpan(ArraySegment<T> segment, Index startIndex);
	public static Span<T> AsSpan<T> (this ArraySegment<T> segment, Index startIndex);
	static member AsSpan : ArraySegment<'T> * Index -> Span<'T>
	<Extension()>
Public Function AsSpan(Of T) (segment As ArraySegment(Of T), startIndex As Index) As Span(Of T)
    类型参数
- T
 
数组段的类型。
参数
- segment
 - ArraySegment<T>
 
目标数组段。
- startIndex
 - Index
 
开始跨度处的索引。
返回
数组段的跨度表示形式。
适用于
AsSpan<T>(ArraySegment<T>, Int32)
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
从指定位置到段的结尾,在目标数组段的一部分上创建新的跨度。
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static Span<T> AsSpan(ArraySegment<T> segment, int start);
	public static Span<T> AsSpan<T> (this ArraySegment<T> segment, int start);
	static member AsSpan : ArraySegment<'T> * int -> Span<'T>
	<Extension()>
Public Function AsSpan(Of T) (segment As ArraySegment(Of T), start As Integer) As Span(Of T)
    类型参数
- T
 
数组段的类型。
参数
- segment
 - ArraySegment<T>
 
目标数组段。
- start
 - Int32
 
开始跨度处的索引。
返回
数组段的跨度表示形式。
例外
              segment 是协变的,数组的类型不完全是 T[]。
              start 小于 0 或大于 segment.Count。
注解
当 为 null时segment返回 default 。
适用于
AsSpan<T>(ArraySegment<T>, Range)
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
使用范围起始和结束索引在目标数组段的一部分上创建新的跨度。
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static Span<T> AsSpan(ArraySegment<T> segment, Range range);
	public static Span<T> AsSpan<T> (this ArraySegment<T> segment, Range range);
	static member AsSpan : ArraySegment<'T> * Range -> Span<'T>
	<Extension()>
Public Function AsSpan(Of T) (segment As ArraySegment(Of T), range As Range) As Span(Of T)
    类型参数
- T
 
数组段的类型。
参数
- segment
 - ArraySegment<T>
 
目标数组段。
- range
 - Range
 
带有开始和结束索引的范围,用于对数组进行切片。
返回
数组段的跨度表示形式。
适用于
AsSpan<T>(T[], Index)
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
在由 Index 值定义的目标数组部分上创建新的跨度。
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static Span<T> AsSpan(cli::array <T> ^ array, Index startIndex);
	public static Span<T> AsSpan<T> (this T[]? array, Index startIndex);
	public static Span<T> AsSpan<T> (this T[] array, Index startIndex);
	static member AsSpan : 'T[] * Index -> Span<'T>
	<Extension()>
Public Function AsSpan(Of T) (array As T(), startIndex As Index) As Span(Of T)
    类型参数
- T
 
数组类型。
参数
- array
 - T[]
 
要转换的数组。
- startIndex
 - Index
 
起始索引。
返回
数组的跨度表示形式。
适用于
AsSpan<T>(T[], Int32)
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
从指定位置开始到数组的结尾,在目标数组的一部分上创建一个新的跨度。
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static Span<T> AsSpan(cli::array <T> ^ array, int start);
	public static Span<T> AsSpan<T> (this T[]? array, int start);
	public static Span<T> AsSpan<T> (this T[] array, int start);
	static member AsSpan : 'T[] * int -> Span<'T>
	<Extension()>
Public Function AsSpan(Of T) (array As T(), start As Integer) As Span(Of T)
    类型参数
- T
 
数组的类型。
参数
- array
 - T[]
 
要转换的数组。
- start
 - Int32
 
转换数组的初始索引。
返回
数组的跨度表示形式。
适用于
AsSpan<T>(T[], Range)
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
在由 Range 值定义的目标数组部分上创建新的跨度。
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static Span<T> AsSpan(cli::array <T> ^ array, Range range);
	public static Span<T> AsSpan<T> (this T[]? array, Range range);
	public static Span<T> AsSpan<T> (this T[] array, Range range);
	static member AsSpan : 'T[] * Range -> Span<'T>
	<Extension()>
Public Function AsSpan(Of T) (array As T(), range As Range) As Span(Of T)
    类型参数
- T
 
数组的类型。
参数
- array
 - T[]
 
要转换的数组。
- range
 - Range
 
要转换的数组范围。
返回
数组的跨度表示形式。
适用于
AsSpan<T>(ArraySegment<T>, Int32, Int32)
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
从指定长度的指定位置在目标数组段的一部分上创建新的跨度。
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static Span<T> AsSpan(ArraySegment<T> segment, int start, int length);
	public static Span<T> AsSpan<T> (this ArraySegment<T> segment, int start, int length);
	static member AsSpan : ArraySegment<'T> * int * int -> Span<'T>
	<Extension()>
Public Function AsSpan(Of T) (segment As ArraySegment(Of T), start As Integer, length As Integer) As Span(Of T)
    类型参数
- T
 
数组段的类型。
参数
- segment
 - ArraySegment<T>
 
目标数组段。
- start
 - Int32
 
开始跨度处的索引。
- length
 - Int32
 
跨度中的项数。
返回
数组的跨度表示形式。
例外
              segment 是协变的,数组的类型不完全是 T[]。
              start、length 或 start + length 不在 segment 的范围内。
注解
当 为 null时segment返回 default 。
适用于
AsSpan<T>(T[], Int32, Int32)
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
- Source:
 - MemoryExtensions.cs
 
从指定长度的指定位置在目标数组的一部分上创建新的跨度。
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static Span<T> AsSpan(cli::array <T> ^ array, int start, int length);
	public static Span<T> AsSpan<T> (this T[]? array, int start, int length);
	public static Span<T> AsSpan<T> (this T[] array, int start, int length);
	static member AsSpan : 'T[] * int * int -> Span<'T>
	<Extension()>
Public Function AsSpan(Of T) (array As T(), start As Integer, length As Integer) As Span(Of T)
    类型参数
- T
 
数组的类型。
参数
- array
 - T[]
 
目标数组。
- start
 - Int32
 
开始跨度处的索引。
- length
 - Int32
 
跨度中的项数。
返回
数组的跨度表示形式。
例外
              array 是协变的,数组的类型不完全是 T[]"。
              start、length 或 start + length 不在 array 的范围内。
注解
当 为 null时array返回 default 。