Quantcast
Channel: C#タグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 9743

[C#] Span構造体からref Tを取得する方法の違い

$
0
0

普通に使う分にはref span[0]が良さそう。

メソッドIsEmpty == trueReadOnlySpanの場合
ref span[0]IndexOutOfRangeException不可(ref readonlyは可)
Span<T>.GetPinnableReference()Unsafe.AsRef<T>(null)不可(ref readonlyは可)IntelliSenseでは出てこない
MemoryMarshal.GetReference(Span<T>)Unsafe.AsRef<T>(null)

Viewing all articles
Browse latest Browse all 9743

Trending Articles