Divooka Reference

Data Types

Stable

Lists, dictionaries, sets, and conversions from one kind of value to another

Guide on the Methodox Wiki

222 nodes in 10 categories

Ships with
Divooka ExploreDivooka Compute
Support tier
Tier 1 (proposed)
Package
Standard Library
Standard Library

Numbers, text, dates, arrays, lists, dictionaries, sets and conversions - what nearly every graph needs.

Enumerable Routines

AllWhether every element passes a test; it stops at the first that does not.AnyWhether the sequence has any elements at all; it reads at most one, so it is the cheap way to test for emptiness.AppendThe sequence with one more element at the end; the source itself is not changed.As EnumerablePasses the sequence through unchanged but typed as a plain sequence, hiding its concrete collection type so that later steps treat it only as something to enumerate.AverageThe mean of the numbers, as a double so that it keeps its fraction.CastTreats every element of an untyped sequence as a T Result, for when all elements are known to be of that type.ChunkSplits the sequence into consecutive batches of Size elements, for example to process items a page at a time; the last batch is shorter when the length is not a multiple of the size.ConcatJoins two sequences end to end, keeping duplicates; use EnumerableRoutines.Union to merge without duplicates.ContainsWhether the sequence holds an element equal to Value, by the elements' default equality.CountHow many elements the sequence has.Default If EmptyThe sequence unchanged when it has any elements; when it is empty, a sequence holding exactly one default value instead (null for reference and nullable types, zero or false for numbers and booleans), so that a later step always has something to work on.DistinctThe sequence with repeated elements removed, comparing elements by their default equality; the first occurrence of each is kept, in the order they first appear.Distinct ByOne element per key, for example one person per surname: the first element seen with each key is kept, in their original order.Element AtThe element at a position, counting from zero.Element At Or DefaultThe element at a position, counting from zero, or the type's default value (null for reference and nullable types, zero for numbers) when Index is negative or past the end.EmptyA sequence with no elements, for use as a starting point or as a placeholder where a sequence input is required.ExceptThe distinct elements of First that do not appear in Second, in the order of First.Except ByThe elements of First whose key is not in a list of keys, for example everyone except the IDs in an exclusion list; one element per key, the first seen, in the order of First.FirstThe first element.First Or DefaultThe first element, or the type's default value (null for reference and nullable types, zero for numbers) when the sequence is empty.Group ByGathers elements that share a key into groups, for example orders by customer.Group JoinPairs each element of Outer with all the elements of Inner that share its key, for example each customer with their orders.IntersectThe distinct elements of First that also appear in Second, in the order of First.Intersect ByThe elements of First whose key appears in a list of keys, for example the people whose IDs are in a selection; one element per key, the first seen, in the order of First.JoinMatches elements of two sequences by key (an inner join), for example orders to their customers: every pair whose keys are equal gives one result.LastThe last element.Last Or DefaultThe last element, or the type's default value (null for reference and nullable types, zero for numbers) when the sequence is empty.Long CountHow many elements the sequence has, as a 64-bit number for sequences too long for EnumerableRoutines.Count.MaxThe largest element, by the elements' default comparison.MinThe smallest element, by the elements' default comparison.Of TypeKeeps only the elements of an untyped sequence that are a T Result (or derive from it); nulls and elements of any other type are dropped, so unlike EnumerableRoutines.Cast it never throws for a mismatched element.OrderThe elements sorted from smallest to largest by their default comparison (numbers by value, text in the current culture's order).Order BySorts elements from smallest to largest by a key worked out from each, for example people by age.Order By DescendingSorts elements from largest to smallest by a key worked out from each, for example scores from highest to lowest.Order DescendingThe elements sorted from largest to smallest by their default comparison.PrependThe sequence with one more element at the start; the source itself is not changed.RangeA run of consecutive whole numbers: Count of them, starting at Start, so a start of 1 and a count of 10 gives 1 to 10.RepeatA sequence holding the same value Count times.ReverseThe elements in reverse order.SelectTransforms each element through Selector, for example from a list of people to a list of their names.Select ManyTurns each element into a sequence and joins all those sequences end to end into one flat sequence, for example from a list of folders to one list of all their files.SingleThe one and only element, for when having exactly one is an expectation worth checking.Single Or DefaultThe only element, or the type's default value (null for reference and nullable types, zero for numbers) when the sequence is empty.SkipThe sequence without its first Count elements.Skip LastThe sequence without its last Count elements.Skip WhileLeaves out elements from the start for as long as Predicate answers true, then gives the first element it rejected and every element after it, whether or not they would pass.SumThe total of the numbers; an empty sequence gives 0.TakeThe first Count elements of the sequence: fewer when it is shorter, and none when the count is zero or less.Take LastThe last Count elements of the sequence: fewer when it is shorter, and none when the count is zero or less.Take WhileElements from the start for as long as Predicate answers true; it stops at the first element that fails, even if later elements would pass.Then ByRefines an existing sort: elements that tie on the earlier keys are put in ascending order of this further key, for example surname then first name.Then By DescendingRefines an existing sort: elements that tie on the earlier keys are put in descending order of this further key.To ArrayReads the whole sequence now and copies its elements into a new array, so later steps work on a fixed snapshot instead of re-running the query.To DictionaryReads the whole sequence into a new dictionary, keying each element by Key Selector.To Hash SetReads the whole sequence into a new set, dropping duplicates, for fast membership tests or further set operations.To ListReads the whole sequence now and copies its elements into a new list, so later steps work on a fixed snapshot that can also be added to.To LookupReads the whole sequence now into a lookup: a fixed, read-only grouping in which each key can have many elements, for example all orders per customer.UnionEvery distinct element found in either sequence: those of First in order, then those of Second not already seen.Union ByMerges two sequences keeping one element per key, for example one entry per ID across two lists; the first element seen with each key is kept, those of First before those of Second.WhereFilters a sequence: only the elements for which Predicate answers true, in their original order.

List Routines

AddAppends an element to the end of the list.Add RangeAppends every element of a sequence to the end of the list, keeping their order.As Read OnlyA read-only view of the list, for handing its contents on without letting the receiver change them.Binary SearchFinds a value in a list that is already sorted in ascending order, much faster than a front-to-back search on a long list.CapacityHow many elements the list can hold before it has to grow its storage; always at least its count.ClearRemoves every element, leaving an empty list; its reserved capacity is kept.CloneA new list with the same elements in the same order, so the copy can be changed without affecting the original.ContainsWhether the list holds an element equal to the given value.Convert AllA new list made by passing each element through a converter, for turning a list of one type into another, such as numbers into labels.Copy ToCopies every element of the list into an existing array, starting at the array's first slot.CountHow many elements the list currently holds.CreateA new, empty list that you can add elements to.Ensure CapacityMakes sure the list has room for at least the given number of elements, growing its storage if it is smaller; the elements themselves are not changed.ExistsWhether at least one element passes a test, for questions such as "is any value negative?".FindThe first element, from the front, that passes a test.Find IndexThe position of the first element that passes a test, searching from the front.Find LastThe last element, searching from the back, that passes a test.FirstThe first element of the list.For EachRuns an action once for each element, front to back, for side effects such as printing or accumulating.GetThe element at a position in the list, counting from 0.Get RangeA new list holding a run of consecutive elements copied from this one.Index OfThe position of the first element equal to the given value, searching from the front.InsertInserts an element at a position, moving the element there and everything after it one place along.Insert RangeInserts every element of a sequence at a position, keeping their order and moving the existing elements from there onwards along to make room.Is EmptyWhether the list has no elements.LastThe last element of the list.Last Index OfThe position of the last element equal to the given value, searching from the back.RemoveRemoves the first element equal to the given value, if there is one; later duplicates stay.Remove AllRemoves every element that passes a test, for filtering a list in place.Remove AtRemoves the element at a position, moving everything after it one place back.Remove RangeRemoves a run of consecutive elements, moving everything after them back to close the gap.ReverseReverses the order of all elements in place, so the last becomes first.SetReplaces the element at a position in the list with a new value.Set CapacitySets exactly how many elements the list has room for, to reserve space ahead of time or release unused space.SliceA new list holding a run of consecutive elements copied from this one; the same as Get Range, named for those used to slicing.SortSorts the list in place in ascending order: numbers smallest first, text alphabetically.To ArrayThe list's elements copied into a new array, in the same order, for nodes that take an array.Trim ExcessShrinks the list's reserved storage to fit its elements, to give memory back once a list has finished growing.True For AllWhether every element passes a test, for questions such as "are all values positive?".Try FirstReads the first element if the list has one, without throwing on an empty list.Try GetReads the element at a position if there is one, without throwing when the position is out of range.Try LastReads the last element if the list has one, without throwing on an empty list.

Conversion Routines

Boolean to TextConverts a boolean to its string representation.Number Byte to TextConverts a byte to its string representation.Character to TextConverts a char to its string representation.Convert Value TypeConverts the specified input to the type T.High Accuracy Number (decimal) to TextConverts a decimal to its string representation.Number to TextWrites a number as text in the one spelling every machine shares: a dot for the decimal point and no grouping, such as 1.5.Low Accuracy Number (float) to TextConverts a float to its string representation.Integer to TextConverts an integer to its string representation.Large Number to TextConverts a long to its string representation.Small Integer (short) to TextConverts a short to its string representation.Signed Number Byte to TextConverts an sbyte to its string representation.Text to BooleanConverts a string to a boolean.String To ByteConverts a string to a byte-sized integer.Text to CharacterConverts a string containing a single character to a char.Text to High Accuracy Number (decimal)Converts a string to a decimal.Text to NumberReads a number from text in the one spelling every machine shares: a dot for the decimal point and no grouping, such as 1.5 or -2.25e3.Text to Low Accuracy Number (float)Converts a string to a float.Text to IntegerConverts a string to an integer.Text to LinesText to Large IntegerConverts a string to a long.Text to Small Integer (short)Converts a string to a short.Text to Signed Number ByteConverts a string to a signed byte (sbyte).Text to Unsigned Integer (uint)Converts a string to an unsigned integer (uint).Text to Unsigned Large Integer (ulong)Converts a string to an unsigned long (ulong).Text to Unsigned Small Integer (ushort)Converts a string to an unsigned short (ushort).Value to Number ByteValue to High Accuracy NumberValue to NumberValue to Low Accuracy NumberValue to IntegerValue to Large IntegerValue to Small IntegerValue to Signed Number ByteValue to Unsigned IntegerValue to Unsigned Large IntegerValue to Unsigned Small IntegerUnsigned Integer (uint) to TextConverts a uint to its string representation.Unsigned Large Integer (ulong) to TextConverts an ulong to its string representation.Unsigned Small Integer (ushort) to TextConverts a ushort to its string representation.Bytes to UTF8Converts UTF8 bytes to its string representation.UTF8 to BytesConverts a UTF8 encoded string to bytes.

Dictionary Routines

AddAdds a new entry, throwing System.ArgumentException if the dictionary already has the key, so an accidental duplicate is caught rather than silently overwriting.Add Or Reject DuplicateAdds a new entry like DictionaryRoutines.TryAdd, and when the key already exists also gives you a message naming the duplicate key, ready to show or log; the existing entry is left untouched.Add RangeAdds many key/value pairs at once, in the order given.CapacityHow many entries the dictionary can hold before it next has to grow its storage; always at least its count.ClearRemoves every entry; the dictionary keeps its current capacity, so refilling it does not have to grow it again.CloneMakes a new dictionary holding the same entries as Source; adding or removing entries in one afterwards does not affect the other, but the values themselves are not copied, so a value of a reference type is shared by both.ComparerThe comparer the dictionary uses to decide whether two keys are the same, so you can make another dictionary that matches keys the same way.Contains KeyWhether the dictionary has an entry for Key, matched with the dictionary's key comparer.Contains ValueWhether any entry has Value as its value, compared with the value type's default equality.CountHow many key/value pairs the dictionary holds.CreateMakes a new, empty dictionary whose keys are compared with the key type's default equality.Ensure CapacityGrows the dictionary's storage, if needed, so it can hold at least Capacity entries without growing again; it never shrinks it.GetThe value stored under Key; use it when the key must be there, and DictionaryRoutines.GetOrDefault or DictionaryRoutines.TryGet when it may not be.Get Or DefaultThe value stored under Key, or Default Value when the dictionary has no such key.KeysThe dictionary's keys, in no guaranteed order.RemoveRemoves the entry for Key, if there is one.SetStores Value under Key, adding a new entry or replacing the value already there; use DictionaryRoutines.Add instead when a duplicate key should be an error.To ArrayCopies every key/value pair into a new array, a snapshot that later changes to the dictionary do not affect.Trim ExcessShrinks the dictionary's storage to fit the entries it holds now, giving back memory after many removals.Try AddAdds a new entry only if the key is not already there; an existing entry is left untouched.Try GetLooks up Key without failing when it is missing, telling you both whether it was found and what it holds.ValuesThe dictionary's values, in the same order as DictionaryRoutines.Keys.

Value Tuple Routines

CompareOrders two tuples of the same type element by element: the first position where they differ decides, as in sorting by several columns.Compare ObjectsOrders two values when you only have them as plain objects, using the left value's own comparison; null sorts before everything else.CreateMakes the empty tuple, which holds no elements; it is the tuple form of "nothing", and every empty tuple equals every other.EqualsWhether two tuples of the same type hold equal elements, position by position, using each element type's default equality.FormatWrites a tuple as text, its elements separated by commas inside parentheses, for example (1, apple, True).GetThe element at a position in a tuple, counting from zero; use ValueTupleRoutines.TryGet when the position may be out of range.HashA hash code combining the tuple's elements, so equal tuples get equal codes; use it for bucketing or quick inequality checks.Is TupleWhether Value is a tuple, so the other tuple routines can read it.Is Tuple TypeWhether Type is a value tuple type of any size, from the empty tuple up to seven elements plus a nested rest; for checking a type before you have a value of it.LengthHow many elements a tuple holds, counting through the nested rest of a tuple with more than seven elements.Structural CompareOrders two tuples element by element like ValueTupleRoutines.Compare, with Comparer ordering each pair of elements, for example to sort text elements case-insensitively.Structural EqualsWhether two tuples hold equal elements, position by position, with Comparer deciding each pair, for example to compare text elements case-insensitively.Structural HashA hash code for a tuple in which each element is hashed by Comparer, to pair with ValueTupleRoutines.StructuralEquals using the same comparer, for example to treat text elements case-insensitively.To ArrayCopies a tuple's elements into a new array in order, so they can be handled as a list.Try GetReads the element at a position in a tuple without throwing, telling you whether there was one.Validate TupleChecks that a value is a tuple and throws if it is not, so a graph fails at a clear point instead of further on.

Set Routines

AddClearRemoves every element from the set, in place; the set itself stays usable and keeps its equality rule.CloneAn independent copy of the set with the same elements and the same equality rule, so that changing one does not change the other.ComparerThe equality rule the set uses to decide which elements are the same, for creating another set that behaves alike.ContainsWhether the set holds an element equal to Item, by the set's own equality rule; this is a fast lookup, however large the set.CountHow many elements the set holds.CreateA new, empty set that compares its elements by their default equality.ExceptThe first operand's elements minus the second's, in a new set; both operands untouched.IntersectOnly the elements both operands have, in a new set; both operands untouched.Is EmptyWhether the set holds no elements.Is Subset OfWhether every element of Set is also in Other, by the set's equality rule.Is Superset OfWhether every element of Other is also in Set, by the set's equality rule.OverlapsWhether the set and the other elements have at least one element in common, by the set's equality rule; false when either is empty.RemoveSet EqualsWhether the set and the other elements hold exactly the same elements, by the set's equality rule, ignoring order and any duplicates in Other.Symmetric ExceptThe elements in exactly one of the two operands, in a new set; both operands untouched.To ArrayCopies the set's elements into a new array, for when an indexed or ordered collection is needed.To ListCopies the set's elements into a new list, for when an indexed collection that can hold duplicates is needed.UnionEvery element in either operand, in a new set; both operands untouched.

Quick Store

Object Routines

Dynamic Operations

Collections Helper