Skip to content

Collections Array

Eduard Gushchin edited this page Jul 1, 2026 · 5 revisions

Home | API by Category | Complete API Index | API Compatibility

Field Value
Full name Electron2D.Collections.Array
Namespace Electron2D.Collections
Kind class
Category Math and Data

Overview

Stores an ordered mutable list of Electron2D.Variant values.

Syntax

public sealed class Electron2D.Collections.Array : System.Collections.Generic.IEnumerable<Electron2D.Variant>, System.Collections.IEnumerable

Godot 4.7 C# profile compatibility

Profile: Electron2D 0.1.0 2D
Status: Partial / Not verified
Out of profile: yes
Godot reference: Array

Mutable reference-like Variant list for the 0.1 closed Variant type set.

Remarks

This type stores only values that can be represented by Electron2D.Variant and is intended for dynamic Electron2D APIs.

The container itself is reference-like: assigning the same instance to multiple variants stores the same mutable array object.

Thread Safety

This type is not synchronized. External synchronization is required when the same instance is mutated from multiple threads.

Since

This type is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Collections.Dictionary
  • Electron2D.Variant

Members

Member Kind Summary
Count Property Gets the number of values stored in the array.
Item Property Gets or sets the value at the specified index.
Electron2D.Collections.Array() Constructor Initializes a new instance of the Array type.
Add(Electron2D.Variant) Method Appends a value to the end of the array.
Clear() Method Removes all values from the array.
GetEnumerator() Method Returns an enumerator over the current values.
RemoveAt(System.Int32) Method Removes the value at the specified index.
ToArray() Method Returns a snapshot of the current array values.
ToString() Method Returns a diagnostic string representation of this array.

Member Details

Count

Kind: Property

public System.Int32 Count { get; }

Summary

Gets the number of values stored in the array.

Remarks

This value changes when Electron2D.Collections.Array.Add(Electron2D.Variant), Electron2D.Collections.Array.RemoveAt(System.Int32) or Electron2D.Collections.Array.Clear mutates the container.

Value

The current number of Electron2D.Variant values.

Thread Safety

This property is not synchronized. External synchronization is required when the same instance is accessed from multiple threads.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Collections.Array

Item

Kind: Property

public Electron2D.Variant this[System.Int32 index] { get; set; }

Summary

Gets or sets the value at the specified index.

Remarks

The getter and setter access the live mutable container. Assigning a value replaces the existing element without changing Electron2D.Collections.Array.Count.

Parameters

  • index: The zero-based index of the value.

Returns

The stored Electron2D.Variant value.

Value

The value at the specified index.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when index is outside the array bounds.

Thread Safety

This indexer is not synchronized. External synchronization is required when the same instance is accessed from multiple threads.

Since

This indexer is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Collections.Array.Add(Electron2D.Variant)
  • Electron2D.Collections.Array.RemoveAt(System.Int32)

Electron2D.Collections.Array()

Kind: Constructor

public Electron2D.Collections.Array()

Summary

Initializes a new instance of the Array type.

Remarks

The new instance follows the lifetime and validation rules of its declaring type.

Thread Safety

This member is not synchronized. Call it from the thread that owns the related object unless the declaring type states otherwise.

Since

This API is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Collections.Array

Add(Electron2D.Variant)

Kind: Method

public System.Void Add(Electron2D.Variant)(Electron2D.Variant value)

Summary

Appends a value to the end of the array.

Remarks

The appended value becomes available at index Count - 1 after the call returns.

Parameters

  • value: The value to append.

Thread Safety

This method is not synchronized. External synchronization is required when the same instance is mutated from multiple threads.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Collections.Array.Clear
  • Electron2D.Collections.Array.RemoveAt(System.Int32)

Clear()

Kind: Method

public System.Void Clear()()

Summary

Removes all values from the array.

Remarks

Existing references to this Electron2D.Collections.Array observe the same mutable instance after it has been cleared.

Thread Safety

This method is not synchronized. External synchronization is required when the same instance is mutated from multiple threads.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Collections.Array.Count

GetEnumerator()

Kind: Method

public System.Collections.Generic.IEnumerator<Electron2D.Variant> GetEnumerator()()

Summary

Returns an enumerator over the current values.

Remarks

The enumerator follows the behavior of System.Collections.Generic.List1.GetEnumerator`. Mutating this container while enumerating it invalidates the enumerator.

Returns

An enumerator over Electron2D.Variant values.

Thread Safety

This method is not synchronized. External synchronization is required when the same instance may be mutated while it is being enumerated.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Collections.Array.ToArray

RemoveAt(System.Int32)

Kind: Method

public System.Void RemoveAt(System.Int32)(System.Int32 index)

Summary

Removes the value at the specified index.

Remarks

Values after index shift down by one position.

Parameters

  • index: The zero-based index of the value to remove.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when index is outside the array bounds.

Thread Safety

This method is not synchronized. External synchronization is required when the same instance is mutated from multiple threads.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Collections.Array.Add(Electron2D.Variant)
  • Electron2D.Collections.Array.Clear

ToArray()

Kind: Method

public Electron2D.Variant[] ToArray()()

Summary

Returns a snapshot of the current array values.

Remarks

The returned CLR array is a snapshot. Later changes to this Electron2D.Collections.Array do not change the returned array instance.

Returns

A new CLR array containing the current Electron2D.Variant values.

Thread Safety

This method is not synchronized. External synchronization is required when the same instance may be mutated while the snapshot is being made.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Collections.Array.GetEnumerator

ToString()

Kind: Method

public System.String ToString()()

Summary

Returns a diagnostic string representation of this array.

Remarks

The result is intended for diagnostics and logs. It is not a stable serialization format.

Returns

A comma-separated list of values wrapped in square brackets.

Thread Safety

This method is not synchronized. External synchronization is required when the same instance may be mutated while the string is being built.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Collections.Array

Clone this wiki locally