Rediger

Del via


CollectionsMarshal Class

Definition

An unsafe class that provides a set of methods to access the underlying data representations of collections.

public ref class CollectionsMarshal abstract sealed
public static class CollectionsMarshal
type CollectionsMarshal = class
Public Class CollectionsMarshal
Inheritance
CollectionsMarshal

Methods

AsSpan<T>(List<T>)

Gets a Span<T> view over the data in a list. Items should not be added or removed from the List<T> while the Span<T> is in use.

GetValueRefOrAddDefault<TKey,TValue,TAlternateKey>(Dictionary<TKey,TValue>.AlternateLookup<TAlternateKey>, TAlternateKey, Boolean)

Gets a ref to a TValue in the Dictionary<TKey,TValue>.AlternateLookup<TAlternateKey>, adding a new entry with a default value if it does not exist in the dictionary.

GetValueRefOrAddDefault<TKey,TValue>(Dictionary<TKey,TValue>, TKey, Boolean)

Gets a reference to a TValue in the specified dictionary, adding a new entry with a default value if the key does not exist.

GetValueRefOrNullRef<TKey,TValue,TAlternateKey>(Dictionary<TKey,TValue>.AlternateLookup<TAlternateKey>, TAlternateKey)

Gets either a ref to a TValue in the Dictionary<TKey,TValue> or a ref null if it does not exist in the dictionary.

GetValueRefOrNullRef<TKey,TValue>(Dictionary<TKey,TValue>, TKey)

Gets either a reference to a TValue in the Dictionary<TKey,TValue> or a reference null if it does not exist in the dictionary.

SetCount<T>(List<T>, Int32)

Sets the count of the List<T> to the specified value.

Applies to