TwigExtensionMethods

public static class TwigExtensionMethods

Methods

Cycle<T>

#Example
public static Twig<T> Cycle<T>(this Twig<T> twig, int newStartIndex)
Cycle all the items and metas in a twig until the item at the given index is the first item in the twig.
twig (Twig<T>)
newStartIndex (int)

GetNonNullIndex

#Example
public static int GetNonNullIndex(this ITwig twig, int targetNonNullIndex)
Find the twig index which is associated with the i-th non-null item index.
twig (ITwig)
targetNonNullIndex (int)

ItemsBackwards<T>

#Example
public static IEnumerable<T> ItemsBackwards<T>(this Twig<T> twig, int firstIndex)
Enumerate backwards over all non-null items in a twig starting at a given offset.
twig (Twig<T>)Twig to iterate over.
firstIndex (int)Initial index.

ItemsForwards<T>

#Example
public static IEnumerable<T> ItemsForwards<T>(this Twig<T> twig, int firstIndex)
Enumerate forwards over all non-null items in a twig starting at a given offset.
twig (Twig<T>)Twig to iterate over.
firstIndex (int)Initial index.

NonNullIndices

#Example
public static int[] NonNullIndices(this ITwig twig)
Get an array containing all the indices of non-null items in the twig.
twig (ITwig)

PearsBackwards<T>

#Example
public static IEnumerable<Pear<T>> PearsBackwards<T>(this Twig<T> twig, int firstIndex)
Enumerate backwards over all non-null items in a twig starting at a given offset.
twig (Twig<T>)Twig to iterate over.
firstIndex (int)Initial index.

PearsForwards<T>

#Example
public static IEnumerable<Pear<T>> PearsForwards<T>(this Twig<T> twig, int firstIndex)
Enumerate forwards over all non-null items in a twig starting at a given offset.
twig (Twig<T>)Twig to iterate over.
firstIndex (int)Initial index.

TypeOverlap

#Example
public static TypeOverlap TypeOverlap(this ITwig twig)
Resolve the type overlap for all types (minus all nulls) in a twig.
twig (ITwig)
Type overlap or null if there are no actual values in the twig.