reckfellENGINE

Reckfell.Collections.Array<T>

Typed wrapper around Reckfell's Array class, an array of T annotated, Variant typed elements allocated in the engine in C++. Useful when interfacing with the engine. Otherwise prefer .NET collections such as arrays or System.Collections.Gen

On this page
class Reckfell.Collections.Array<T>ReckfellSharp

Typed wrapper around Reckfell's Array class, an array of T annotated, Variant typed elements allocated in the engine in C++. Useful when interfacing with the engine. Otherwise prefer .NET collections such as arrays or System.Collections.Generic.List1`.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors4

Array4 overloads
# Array · 1/4
C#
public Array();

Constructs a new empty Reckfell.Collections.Array<T>.

# Array · 2/4
C#
public Array(Reckfell.Collections.Array array);

Constructs a typed Reckfell.Collections.Array<T> from an untyped Reckfell.Collections.Array.

Parameters
NameTypeDefault
arrayReckfell.Collections.Array—
array

The untyped array to construct from.

# Array · 3/4
C#
public Array(System.Collections.Generic.IEnumerable<T> collection);

Constructs a new Reckfell.Collections.Array<T> from the given collection's elements.

Parameters
NameTypeDefault
collectionSystem.Collections.Generic.IEnumerable<T>—
collection

The collection of elements to construct from.

# Array · 4/4
C#
public Array(T[] array);

Constructs a new Reckfell.Collections.Array<T> from the given items.

Parameters
NameTypeDefault
arrayT[]—
array

The items to put in the new array.

Properties3

CountProperty
# Count
C#
public int Count { get; }

Returns the number of elements in this Reckfell.Collections.Array<T>. This is also known as the size or length of the array.

IsReadOnlyProperty
# IsReadOnly
C#
public bool IsReadOnly { get; }

Returns true if the array is read-only. See Reckfell.Collections.Array<T>.MakeReadOnly.

ItemProperty
# Item
C#
public T? this[int index] { get; set; }

Returns the item at the given InputEventScreenDrag.Index.

Methods36

Addvoid
# Add
C#
public void Add(T? item);

Adds an item to the end of this Reckfell.Collections.Array<T>. This is the same as append or push_back in ExcludedScript.

Parameters
NameTypeDefault
itemT—
item

The Variant item to add.

AddRange3 overloads
# AddRange · 1/3
C#
public void AddRange(System.Collections.Generic.IEnumerable<T> collection);

Adds the elements of the specified collection to the end of this Reckfell.Collections.Array<T>.

Parameters
NameTypeDefault
collectionSystem.Collections.Generic.IEnumerable<T>—
collection

Collection of Variant items to add.

# AddRange · 2/3
C#
public void AddRange(ReadOnlySpan<T> span);

Adds the elements of the specified span to the end of this Reckfell.Collections.Array<T>.

Parameters
NameTypeDefault
spanReadOnlySpan<T>—
span

The span of Variant items to add.

# AddRange · 3/3
C#
public void AddRange(T[] array);

Adds the elements of the specified array to the end of this Reckfell.Collections.Array<T>.

Parameters
NameTypeDefault
arrayT[]—
array

The array of Variant items to add.

BinarySearch2 overloads
# BinarySearch · 1/2
C#
public int BinarySearch(int index, int count, T? item);

Finds the index of an existing value using binary search. If the value is not present in the array, it returns the bitwise complement of the insertion index that maintains sorting order. Note: Calling Reckfell.Collections.Array<T>.BinarySearch on an unsorted array results in unexpected behavior.

Parameters
NameTypeDefault
indexint—
countint—
itemT—
index

The starting index of the range to search.

count

The length of the range to search.

item

The object to locate.

Returns int

The index of the item in the array, if item is found; otherwise, a negative number that is the bitwise complement of the index of the next element that is larger than item or, if there is no larger element, the bitwise complement of Reckfell.Collections.Array<T>.Count.

# BinarySearch · 2/2
C#
public int BinarySearch(T? item);

Finds the index of an existing value using binary search. If the value is not present in the array, it returns the bitwise complement of the insertion index that maintains sorting order. Note: Calling Reckfell.Collections.Array<T>.BinarySearch on an unsorted array results in unexpected behavior.

Parameters
NameTypeDefault
itemT—
item

The object to locate.

Returns int

The index of the item in the array, if item is found; otherwise, a negative number that is the bitwise complement of the index of the next element that is larger than item or, if there is no larger element, the bitwise complement of Reckfell.Collections.Array<T>.Count.

Clearvoid
# Clear
C#
public void Clear();

Clears the array. This is the equivalent to using Reckfell.Collections.Array<T>.Resize with a size of 0

Containsbool
# Contains
C#
public bool Contains(T? item);

Returns true if the array contains the given value.

Parameters
NameTypeDefault
itemT—
item

The item to look for.

Returns bool

Whether or not this array contains the given item.

CopyTovoid
# CopyTo
C#
public void CopyTo(T[] array, int arrayIndex);

Copies the elements of this Reckfell.Collections.Array<T> to the given C# array, starting at the given index.

Parameters
NameTypeDefault
arrayT[]—
arrayIndexint—
array

The C# array to copy to.

arrayIndex

The index to start at.

DuplicateReckfell.Collections.Array<T>
# Duplicate
C#
public Reckfell.Collections.Array<T> Duplicate(bool deep = false);

Duplicates this Reckfell.Collections.Array<T>.

Parameters
NameTypeDefault
deepboolfalse
deep

If true, performs a deep copy.

Returns Reckfell.Collections.Array<T>

A new Reckfell Array.

Fillvoid
# Fill
C#
public void Fill(T? value);

Assigns the given value to all elements in the array. This can typically be used together with Reckfell.Collections.Array<T>.Resize to create an array with a given size and initialized elements. Note: If Range.Value is of a reference type (ReckfellObject derived, Reckfell.Collections.Array or Reckfell.Collections.Dictionary, etc.) then the array is filled with the references to the same object, i.e. no duplicates are created.

Parameters
NameTypeDefault
valueT—
value

The value to fill the array with.

GetEnumeratorSystem.Collections.Generic.IEnumerator<T>
# GetEnumerator
C#
public System.Collections.Generic.IEnumerator<T> GetEnumerator();

Gets an enumerator for this Reckfell.Collections.Array<T>.

Returns System.Collections.Generic.IEnumerator<T>

An enumerator.

GetSliceRangeReckfell.Collections.Array<T>
# GetSliceRange
C#
public Reckfell.Collections.Array<T> GetSliceRange(int start, int end, int step = 1, bool deep = false);

Returns the slice of the Reckfell.Collections.Array<T>, from start (inclusive) to Aabb.End (exclusive), as a new Reckfell.Collections.Array<T>. The absolute value of AesContext.Start and Aabb.End will be clamped to the array size. If either AesContext.Start or Aabb.End are negative, they will be relative to the end of the array (i.e. arr.GetSliceRange(0, -2) is a shorthand for arr.GetSliceRange(0, arr.Count - 2)). If specified, Animation.Step is the relative index between source elements. It can be negative, then AesContext.Start must be higher than Aabb.End. For example, [0, 1, 2, 3, 4, 5].GetSliceRange(5, 1, -2) returns [5, 3]. If deep is true, each element will be copied by value rather than by reference.

Parameters
NameTypeDefault
startint—
endint—
stepint1
deepboolfalse
start

The zero-based index at which the range starts.

end

The zero-based index at which the range ends.

step

The relative index between source elements to take.

deep

If true, performs a deep copy.

Returns Reckfell.Collections.Array<T>

A new array that contains the elements inside the slice range.

IndexOf2 overloads
# IndexOf · 1/2
C#
public int IndexOf(T? item);

Searches the array for a value and returns its index or -1 if not found.

Parameters
NameTypeDefault
itemT—
item

The Variant item to search for.

Returns int

The index of the item, or -1 if not found.

# IndexOf · 2/2
C#
public int IndexOf(T? item, int index);

Searches the array for a value and returns its index or -1 if not found.

Parameters
NameTypeDefault
itemT—
indexint—
item

The Variant item to search for.

index

The initial search index to start from.

Returns int

The index of the item, or -1 if not found.

Insertvoid
# Insert
C#
public void Insert(int index, T? item);

Inserts a new element at a given position in the array. The position must be valid, or at the end of the array (pos == Count - 1). Existing items will be moved to the right.

Parameters
NameTypeDefault
indexint—
itemT—
index

The index to insert at.

item

The Variant item to insert.

LastIndexOf2 overloads
# LastIndexOf · 1/2
C#
public int LastIndexOf(Variant item);

Searches the array for a value in reverse order and returns its index or -1 if not found.

Parameters
NameTypeDefault
itemVariant—
item

The Variant item to search for.

Returns int

The index of the item, or -1 if not found.

# LastIndexOf · 2/2
C#
public int LastIndexOf(Variant item, int index);

Searches the array for a value in reverse order and returns its index or -1 if not found.

Parameters
NameTypeDefault
itemVariant—
indexint—
item

The Variant item to search for.

index

The initial search index to start from.

Returns int

The index of the item, or -1 if not found.

MakeReadOnlyvoid
# MakeReadOnly
C#
public void MakeReadOnly();

Makes the Reckfell.Collections.Array<T> read-only, i.e. disabled modying of the array's elements. Does not apply to nested content, e.g. content of nested arrays.

MaxT
# Max
C#
public T? Max();

Returns the maximum value contained in the array if all elements are of comparable types. If the elements can't be compared, default is returned.

Returns T

The maximum value contained in the array.

MinT
# Min
C#
public T? Min();

Returns the minimum value contained in the array if all elements are of comparable types. If the elements can't be compared, default is returned.

Returns T

The minimum value contained in the array.

PickRandomT
# PickRandom
C#
public T? PickRandom();

Returns a random value from the target array.

Returns T

A random element from the array.

RecursiveEqualbool
# RecursiveEqual
C#
public bool RecursiveEqual(Reckfell.Collections.Array<T> other);
Parameters
NameTypeDefault
otherReckfell.Collections.Array<T>—
Returns bool
Removebool
# Remove
C#
public bool Remove(T? item);

Removes the first occurrence of the specified item from this Reckfell.Collections.Array<T>.

Parameters
NameTypeDefault
itemT—
item

The value to remove.

Returns bool

A bool indicating success or failure.

RemoveAtvoid
# RemoveAt
C#
public void RemoveAt(int index);

Removes an element from the array by index. To remove an element by searching for its value, use Reckfell.Collections.Array<T>.Remove instead.

Parameters
NameTypeDefault
indexint—
index

The index of the element to remove.

ResizeError
# Resize
C#
public Error Resize(int newSize);

Resizes this Reckfell.Collections.Array<T> to the given size.

Parameters
NameTypeDefault
newSizeint—
newSize

The new size of the array.

Returns Error

Error.Ok if successful, or an error code.

Reversevoid
# Reverse
C#
public void Reverse();

Reverses the order of the elements in the array.

Shufflevoid
# Shuffle
C#
public void Shuffle();

Shuffles the array such that the items will have a random order. This method uses the global random number generator common to methods such as ReckfellApi.Randi. Call ReckfellApi.Randomize to ensure that a new seed will be used each time if you want non-reproducible shuffling.

Slice2 overloads
# Slice · 1/2
C#
public Reckfell.Collections.Array<T> Slice(int start);

Creates a shallow copy of a range of elements in the source Reckfell.Collections.Array<T>.

Parameters
NameTypeDefault
startint—
start

The zero-based index at which the range starts.

Returns Reckfell.Collections.Array<T>

A new array that contains the elements inside the slice range.

# Slice · 2/2
C#
public Reckfell.Collections.Array<T> Slice(int start, int length);

Creates a shallow copy of a range of elements in the source Reckfell.Collections.Array<T>.

Parameters
NameTypeDefault
startint—
lengthint—
start

The zero-based index at which the range starts.

length

The length of the range.

Returns Reckfell.Collections.Array<T>

A new array that contains the elements inside the slice range.

Sortvoid
# Sort
C#
public void Sort();

Sorts the array. Note: The sorting algorithm used is not stable. This means that values considered equal may have their order changed when using Reckfell.Collections.Array<T>.Sort. Note: Strings are sorted in alphabetical order (as opposed to natural order). This may lead to unexpected behavior when sorting an array of strings ending with a sequence of numbers. To sort with a custom predicate use System.Linq.Enumerable.OrderBy``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``1}).

ToStringstring
# ToString
C#
public override string ToString();

Converts this Reckfell.Collections.Array<T> to a string.

Returns string

A string representation of this array.

op_AdditionReckfell.Collections.Array<T>
# op_Addition
C#
public static Reckfell.Collections.Array<T> operator +(Reckfell.Collections.Array<T> left, Reckfell.Collections.Array<T> right);
Parameters
NameTypeDefault
leftReckfell.Collections.Array<T>—
rightReckfell.Collections.Array<T>—
Returns Reckfell.Collections.Array<T>
op_Explicit2 overloads
# op_Explicit · 1/2
C#
public static explicit operator Reckfell.Collections.Array(Reckfell.Collections.Array<T>? from);
Parameters
NameTypeDefault
fromReckfell.Collections.Array<T>—
Returns Reckfell.Collections.Array
# op_Explicit · 2/2
C#
public static explicit operator Reckfell.Collections.Array<T>(Variant from);
Parameters
NameTypeDefault
fromVariant—
Returns Reckfell.Collections.Array<T>
op_ImplicitVariant
# op_Implicit
C#
public static implicit operator Variant(Reckfell.Collections.Array<T> from);
Parameters
NameTypeDefault
fromReckfell.Collections.Array<T>—
Returns Variant
Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.