Memory<T> 구조체
정의
메모리의 연속 영역을 나타냅니다.Represents a contiguous region of memory.
generic <typename T>
public value class Memory : IEquatable<Memory<T>>
generic <typename T>
public value class Memory
public struct Memory<T> : IEquatable<Memory<T>>
public struct Memory<T>
type Memory<'T> = struct
Public Structure Memory(Of T)
Implements IEquatable(Of Memory(Of T))
Public Structure Memory(Of T)
형식 매개 변수
- 상속
- 구현
-
IEquatable<Memory<T>>
설명
Like Span<T> Memory<T>
는 인접 한 메모리 영역을 나타냅니다.Like Span<T>, Memory<T>
represents a contiguous region of memory. 그러나와 달리 Span<T> Memory<T>
는 ref 구조체가아닙니다.Unlike Span<T>, however, Memory<T>
is not a ref struct. 즉,은 Memory<T>
관리 되는 힙에 배치할 수 있지만는 사용할 수 Span<T> 없습니다.This means that Memory<T>
can be placed on the managed heap, whereas Span<T> cannot. 따라서 Memory<T>
구조체의 제한은 인스턴스와 동일 하지 않습니다 Span<T> .As a result, the Memory<T>
structure does not have the same restrictions as a Span<T> instance. 특히 다음 사항에 주의하십시오.In particular:
클래스의 필드로 사용할 수 있습니다.It can be used as a field in a class.
및 경계 전체에서 사용할 수 있습니다
await
yield
.It can be used acrossawait
andyield
boundaries.
외에도를 Memory<T>
사용 하 여 System.ReadOnlyMemory<T> 변경할 수 없거나 읽기 전용 메모리를 나타낼 수 있습니다.In addition to Memory<T>
, you can use System.ReadOnlyMemory<T> to represent immutable or read-only memory.
생성자
Memory<T>(T[]) |
지정된 배열 전체에 새로운 Memory<T> 개체를 만듭니다.Creates a new Memory<T> object over the entirety of a specified array. |
Memory<T>(T[], Int32, Int32) |
지정된 인덱스에서 시작하는 배열의 지정된 요소 수를 포함하는 새 Memory<T> 개체를 만듭니다.Creates a new Memory<T> object that includes a specified number of elements of an array beginning at a specified index. |
속성
Empty | |
IsEmpty |
현재 인스턴스가 비어 있는지 여부를 나타냅니다.Indicates whether the current instance is empty. |
Length |
현재 인스턴스의 항목 수를 가져옵니다.Gets the number of items in the current instance. |
Span |
현재 인스턴스의 범위를 반환합니다.Returns a span from the current instance. |
메서드
CopyTo(Memory<T>) |
Memory<T> 개체의 콘텐츠를 대상 Memory<T> 개체에 복사합니다.Copies the contents of a Memory<T> object into a destination Memory<T> object. |
Equals(Memory<T>) |
지정한 Memory<T> 개체와 현재 개체가 같은지 여부를 확인합니다.Determines whether the specified Memory<T> object is equal to the current object. |
Equals(Object) |
지정된 개체가 현재 개체와 같은지 확인합니다.Determines whether the specified object is equal to the current object. |
GetHashCode() |
이 인스턴스의 해시 코드를 반환합니다.Returns the hash code for this instance. |
Pin() |
Memory<T> 개체의 핸들을 만듭니다.Creates a handle for the Memory<T> object. |
Slice(Int32) |
지정된 인덱스로 시작되는 현재 메모리에서 하나의 조각을 형성합니다.Forms a slice out of the current memory that begins at a specified index. |
Slice(Int32, Int32) |
지정된 인덱스에서 시작하고 지정된 길이만큼 해당하는 현재 메모리에서 벗어난 조각을 형성합니다.Forms a slice out of the current memory starting at a specified index for a specified length. |
ToArray() |
메모리의 콘텐츠를 새 배열로 복사합니다.Copies the contents from the memory into a new array. |
ToString() |
이 Memory<T> 개체의 문자열 표현을 반환합니다.Returns the string representation of this Memory<T> object. |
TryCopyTo(Memory<T>) |
메모리의 콘텐츠를 대상 Memory<T> 인스턴스로 복사합니다.Copies the contents of the memory into a destination Memory<T> instance. |
연산자
Implicit(ArraySegment<T> to Memory<T>) |
ArraySegment<T> 개체를 Memory<T> 개체로 변환하는 암시적 변환을 정의합니다.Defines an implicit conversion of an ArraySegment<T> object to a Memory<T> object. |
Implicit(Memory<T> to ReadOnlyMemory<T>) |
Memory<T> 개체를 ReadOnlyMemory<T> 개체로 변환하는 암시적 변환을 정의합니다.Defines an implicit conversion of a Memory<T> object to a ReadOnlyMemory<T> object. |
Implicit(T[] to Memory<T>) |
배열을 Memory<T> 개체로 변환하는 암시적 변환을 정의합니다.Defines an implicit conversion of an array to a Memory<T> object. |
확장 메서드
Trim<T>(Memory<T>, T) |
메모리 영역에서 지정된 요소의 선행 및 후행 발생 항목을 모두 제거합니다.Removes all leading and trailing occurrences of a specified element from a memory region. |
Trim<T>(Memory<T>, ReadOnlySpan<T>) |
읽기 전용 범위에 지정된 요소 집합의 선행 및 후행 발생 항목을 메모리 영역에서 모두 제거합니다.Removes all leading and trailing occurrences of a set of elements specified in a read-only span from a memory region. |
TrimEnd<T>(Memory<T>, T) |
문자 메모리 영역에서 지정된 요소의 후행 발생 항목을 모두 제거합니다.Removes all trailing occurrences of a specified element from a character memory region. |
TrimEnd<T>(Memory<T>, ReadOnlySpan<T>) |
읽기 전용 범위에 지정된 요소 집합의 후행 발생 항목을 메모리 영역에서 모두 제거합니다.Removes all trailing occurrences of a set of elements specified in a read-only span from a memory region. |
TrimStart<T>(Memory<T>, T) |
메모리 영역에서 지정된 요소의 선행 발생 항목을 모두 제거합니다.Removes all leading occurrences of a specified element from a memory region. |
TrimStart<T>(Memory<T>, ReadOnlySpan<T>) |
읽기 전용 범위에 지정된 요소 집합의 선행 발생 항목을 메모리 영역에서 모두 제거합니다.Removes all leading occurrences of a set of elements specified in a read-only span from a memory region. |