ValueSingleOrList<T> Struct

Summary

A list like struct optimized for holding zero or one items.
Namespace
Avalonia.Utilities
Base Types
  • object
  • ValueType
graph BT Type-->Base0["ValueType"] Base0-->Base1["object"] Type["ValueSingleOrList<T>"] class Type type-node

Syntax

public ref struct ValueSingleOrList<T> : ValueType

Remarks

Once more than value has been added to this storage it will switch to using List internally.

Type Parameters

Name Description
T The type of items held in the list.

Properties

Name Value Summary
HasList bool
If this struct is backed by a list.
IsSingle bool
If this struct contains only single value and storage was not promoted to a list.
List List<T>
List of values.
Single T
Single contained value. Only valid if IsSingle is set.

Methods

Name Value Summary
Add(T) void
Adds a value.
Remove(T) bool
Removes a value.