Once you have aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/atulin/forged/llms.txt
Use this file to discover all available pages before exploring further.
Generator<IEnumerable<T>> or Generator<ICollection<T>> — produced by .Enumerable(), .Array(), .List(), or any other multi-value factory — these extension methods let you materialise the sequence into a specific concrete collection type, randomise its order, or project it into a dictionary, all without leaving the fluent pipeline.
The extensions are split across two files: EnumerableGeneratorExtensions for Generator<IEnumerable<T>> and CollectionGeneratorExtensions for Generator<ICollection<T>>. A further pair of nullable helpers for value types lives in StructGeneratorExtensions and is documented at the bottom of this page.
On Generator<IEnumerable<T>>
.AsList()
Materialises the enumerable into a List<T> via Enumerable.ToList().
Returns Generator<List<T>>
.AsHashSet()
Materialises the enumerable into a HashSet<T> via Enumerable.ToHashSet(). Duplicate values produced by the inner generator are silently deduplicated.
Returns Generator<HashSet<T>>
.AsDictionary<TKey, TValue>(Func<T, TKey> keySelector, Func<T, TValue> valueSelector)
Projects each element of the generated sequence into a Dictionary<TKey, TValue> using caller-supplied key and value selector functions.
A function that extracts the dictionary key from each element. Keys must be non-null (
TKey : notnull).A function that extracts the dictionary value from each element.
Generator<Dictionary<TKey, TValue>>
TKey is constrained to notnull. Passing a key selector that returns null at runtime will throw an ArgumentNullException from ToDictionary. Ensure your key selector always returns a non-null value..Shuffle()
Wraps the generator in a ShuffleGenerator<T> that materialises the sequence into an array, shuffles it in place with Random.Shuffle(Span<T>), and returns the result as IEnumerable<T>.
Returns Generator<IEnumerable<T>>
On Generator<ICollection<T>>
These two methods mirror their IEnumerable<T> counterparts but operate on Generator<ICollection<T>> directly.
.AsList()
Converts the generated ICollection<T> to a List<T>.
Returns Generator<List<T>>
.AsHashSet()
Converts the generated ICollection<T> to a HashSet<T>, deduplicating any repeated elements.
Returns Generator<HashSet<T>>
Struct nullable helpers (from StructGeneratorExtensions)
These two methods are available on any Generator<T> where T : struct. They let you introduce nullable value types into your pipeline without a manual .Refine().
.OrNull(float probability)
Returns a Generator<T?> that produces null with the given probability and the inner generator’s value otherwise.
A value between
0.0 and 1.0 representing the chance of returning null.Generator<T?>
.Nullable()
Lifts a Generator<T> (where T : struct) into a Generator<T?> without introducing any null probability. Every value produced is a non-null T?. Useful when a property’s declared type is T? but you still want every generated object to carry a value.
Returns Generator<T?>