SmallArrayBuilder<'T> Type
Stack-allocated builder for small ImmutableArray results (<= 4 items).
Holds four inline slots and spills to an ImmutableArray.Builder on the 5th item.
ToImmutable() dispatches to the exact-size ImmutableArray.Create overload for
small counts, avoiding both the Builder allocation and the size-fitting copy.
Use as a mutable local:
let mutable xs = SmallArrayBuilder<'T>()
xs.Add(item)
...
xs.ToImmutable()
Single-shot: do not reuse after ToImmutable().
IsByRefLike forces the struct to stay on the stack — it can't be boxed, captured in
a closure, stored in a heap field, or cross an async boundary. This prevents the
silent-copy bugs typical of mutable value types.
Record fields
| Record Field | Description |
Full Usage:
count
Field type: int
Modifiers: mutable |
|
|
|
Full Usage:
t0
Field type: 'T
Modifiers: mutable |
|
Full Usage:
t1
Field type: 'T
Modifiers: mutable |
|
Full Usage:
t2
Field type: 'T
Modifiers: mutable |
|
Full Usage:
t3
Field type: 'T
Modifiers: mutable |
|
Instance members
| Instance member | Description |
Full Usage:
this.Add
Parameters:
'T
|
|
Full Usage:
this.Count
Returns: int
|
|
|
|