Memory<T>.ToArray Memory<T>.ToArray Memory<T>.ToArray Memory<T>.ToArray Method

定義

メモリの内容を新しい配列にコピーします。Copies the contents from the memory into a new array.

public:
 cli::array <T> ^ ToArray();
public T[] ToArray ();
member this.ToArray : unit -> 'T[]
Public Function ToArray () As T()

戻り値

T[]

現在のメモリの要素を含む配列。An array containing the elements in the current memory.

注釈

<xref=System.Memory%601.ToArray%2A>メソッドの呼び出しは、ヒープ割り当てを実行するため、通常は避けてください。Because a call to the <xref=System.Memory%601.ToArray%2A> method performs a heap allocation, it should generally be avoided. ただし、配列でのみ使用できる機能を活用するためには必要です。However, it is sometimes necessary to take advantage of functionality that is only available for arrays.

呼び出しごとに、ToArrayメソッドは新しい配列を返します。Each call to the ToArray method returns a new array.

適用対象