Struct InplaceArray<T>
An array-like object that stores up to four elements.
This is a value type that does not allocate any additional memory.
Syntax
public struct InplaceArray<T> : IEquatable<InplaceArray<T>> where T : struct
Type Parameters
Constructors
InplaceArray(T)
Declaration
public InplaceArray(T elem0)
Parameters
Type |
Name |
Description |
T |
elem0 |
|
InplaceArray(T, T)
Declaration
public InplaceArray(T elem0, T elem1)
Parameters
Type |
Name |
Description |
T |
elem0 |
|
T |
elem1 |
|
InplaceArray(T, T, T)
Declaration
public InplaceArray(T elem0, T elem1, T elem2)
Parameters
Type |
Name |
Description |
T |
elem0 |
|
T |
elem1 |
|
T |
elem2 |
|
InplaceArray(T, T, T, T)
Declaration
public InplaceArray(T elem0, T elem1, T elem2, T elem3)
Parameters
Type |
Name |
Description |
T |
elem0 |
|
T |
elem1 |
|
T |
elem2 |
|
T |
elem3 |
|
Properties
Item[Int32]
Declaration
public T this[int index] { get; set; }
Parameters
Type |
Name |
Description |
Int32 |
index |
|
Property Value
Length
Declaration
public int Length { get; }
Property Value
Methods
Equals(Object)
Check that the arrays are equivalent.
Declaration
public override bool Equals(object other)
Parameters
Type |
Name |
Description |
Object |
other |
|
Returns
Type |
Description |
Boolean |
Whether the arrays are not equivalent
|
Equals(InplaceArray<T>)
Check that the arrays are equivalent.
Declaration
public bool Equals(InplaceArray<T> other)
Parameters
Returns
Type |
Description |
Boolean |
Whether the arrays are not equivalent
|
FromList(IList<T>)
Construct an InplaceArray from an IList (e.g. Array or List).
The source must be non-empty and have at most 4 elements.
Declaration
public static InplaceArray<T> FromList(IList<T> elems)
Parameters
Type |
Name |
Description |
IList<T> |
elems |
|
Returns
GetHashCode()
Get a hashcode for the array.
Declaration
public override int GetHashCode()
Returns
ToString()
Returns a string representation of the array's elements.
Declaration
public override string ToString()
Returns
Operators
Equality(InplaceArray<T>, InplaceArray<T>)
Check that the arrays have the same length and have all equal values.
Declaration
public static bool operator ==(InplaceArray<T> lhs, InplaceArray<T> rhs)
Parameters
Returns
Type |
Description |
Boolean |
Whether the arrays are equivalent.
|
Inequality(InplaceArray<T>, InplaceArray<T>)
Check that the arrays are not equivalent.
Declaration
public static bool operator !=(InplaceArray<T> lhs, InplaceArray<T> rhs)
Parameters
Returns
Type |
Description |
Boolean |
Whether the arrays are not equivalent
|