Struct FixedListByte4096
An unmanaged, resizable list of byte that does not allocate memory. It is 4096 bytes in size, and contains all the memory it needs.
Namespace: Unity.Collections
Syntax
public struct FixedListByte4096 : INativeList<byte>, IEnumerable<byte>, IEnumerable, IEquatable<FixedListByte32>, IComparable<FixedListByte32>, IEquatable<FixedListByte64>, IComparable<FixedListByte64>, IEquatable<FixedListByte128>, IComparable<FixedListByte128>, IEquatable<FixedListByte512>, IComparable<FixedListByte512>, IEquatable<FixedListByte4096>, IComparable<FixedListByte4096>
Constructors
FixedListByte4096(FixedListByte128)
Constructs a new FixedListByte4096 that is a copy of a FixedListByte128.
Declaration
public FixedListByte4096(in FixedListByte128 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte128 | other | The FixedListByte128 to copy |
FixedListByte4096(FixedListByte32)
Constructs a new FixedListByte4096 that is a copy of a FixedListByte32.
Declaration
public FixedListByte4096(in FixedListByte32 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte32 | other | The FixedListByte32 to copy |
FixedListByte4096(FixedListByte512)
Constructs a new FixedListByte4096 that is a copy of a FixedListByte512.
Declaration
public FixedListByte4096(in FixedListByte512 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte512 | other | The FixedListByte512 to copy |
FixedListByte4096(FixedListByte64)
Constructs a new FixedListByte4096 that is a copy of a FixedListByte64.
Declaration
public FixedListByte4096(in FixedListByte64 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte64 | other | The FixedListByte64 to copy |
Properties
Capacity
The number of items that can fit in the list.
Declaration
public int Capacity { get; set; }
Property Value
Type | Description |
---|---|
Int32 | The number of items that the list can hold. |
Implements
Remarks
Capacity specifies the number of items the list can currently hold. You can not change Capacity to fit more or fewer items.
Item[Int32]
Retrieve a member of the list by index.
Declaration
public byte this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index into the list. |
Property Value
Type | Description |
---|---|
Byte | The list item at the specified index. |
Implements
Exceptions
Type | Condition |
---|---|
IndexOutOfRangeException | Thrown if index is negative or >= to Length. |
Length
The current number of items in the list.
Declaration
public int Length { get; set; }
Property Value
Type | Description |
---|---|
Int32 | The item length. |
Implements
Methods
Add(Byte)
Adds an element to the list.
Declaration
public void Add(byte item)
Parameters
Type | Name | Description |
---|---|---|
Byte | item | The byte to be added at the end of the list. |
Exceptions
Type | Condition |
---|---|
IndexOutOfRangeException | Thrown if list is already full. See Capacity. |
AddNoResize(Byte)
Adds an element to the list.
Declaration
public void AddNoResize(byte item)
Parameters
Type | Name | Description |
---|---|---|
Byte | item | The byte to be added at the end of the list. |
Exceptions
Type | Condition |
---|---|
IndexOutOfRangeException | Thrown if list is already full. See Capacity. |
Clear()
Clears the list.
Declaration
public void Clear()
CompareTo(FixedListByte128)
Compares this instance with a specified FixedListByte128 and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified FixedListByte128.
Declaration
public int CompareTo(FixedListByte128 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte128 | other | The specified FixedListByte128 to compare with |
Returns
Type | Description |
---|---|
Int32 |
CompareTo(FixedListByte32)
Compares this instance with a specified FixedListByte32 and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified FixedListByte32.
Declaration
public int CompareTo(FixedListByte32 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte32 | other | The specified FixedListByte32 to compare with |
Returns
Type | Description |
---|---|
Int32 |
CompareTo(FixedListByte4096)
Compares this instance with a specified FixedListByte4096 and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified FixedListByte4096.
Declaration
public int CompareTo(FixedListByte4096 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte4096 | other | The specified FixedListByte4096 to compare with |
Returns
Type | Description |
---|---|
Int32 |
CompareTo(FixedListByte512)
Compares this instance with a specified FixedListByte512 and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified FixedListByte512.
Declaration
public int CompareTo(FixedListByte512 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte512 | other | The specified FixedListByte512 to compare with |
Returns
Type | Description |
---|---|
Int32 |
CompareTo(FixedListByte64)
Compares this instance with a specified FixedListByte64 and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified FixedListByte64.
Declaration
public int CompareTo(FixedListByte64 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte64 | other | The specified FixedListByte64 to compare with |
Returns
Type | Description |
---|---|
Int32 |
Contains(Byte)
Determines whether an element is in the FixedListByte4096.
Declaration
public bool Contains(byte item)
Parameters
Type | Name | Description |
---|---|---|
Byte | item | The object to locate in the FixedListByte4096. |
Returns
Type | Description |
---|---|
Boolean |
ElementAt(Int32)
Declaration
public byte ElementAt(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Returns
Type | Description |
---|---|
Byte |
Implements
Equals(Object)
Compares this instance with a specified object and indicates whether this instance is equal to the specified object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The specified object to compare with for equality |
Returns
Type | Description |
---|---|
Boolean |
Overrides
Equals(FixedListByte128)
Compares this instance with a specified FixedListByte128 and indicates whether this instance is equal to the specified FixedListByte128.
Declaration
public bool Equals(FixedListByte128 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte128 | other | The specified FixedListByte128 to compare with for equality |
Returns
Type | Description |
---|---|
Boolean |
Equals(FixedListByte32)
Compares this instance with a specified FixedListByte32 and indicates whether this instance is equal to the specified FixedListByte32.
Declaration
public bool Equals(FixedListByte32 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte32 | other | The specified FixedListByte32 to compare with for equality |
Returns
Type | Description |
---|---|
Boolean |
Equals(FixedListByte4096)
Compares this instance with a specified FixedListByte4096 and indicates whether this instance is equal to the specified FixedListByte4096.
Declaration
public bool Equals(FixedListByte4096 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte4096 | other | The specified FixedListByte4096 to compare with for equality |
Returns
Type | Description |
---|---|
Boolean |
Equals(FixedListByte512)
Compares this instance with a specified FixedListByte512 and indicates whether this instance is equal to the specified FixedListByte512.
Declaration
public bool Equals(FixedListByte512 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte512 | other | The specified FixedListByte512 to compare with for equality |
Returns
Type | Description |
---|---|
Boolean |
Equals(FixedListByte64)
Compares this instance with a specified FixedListByte64 and indicates whether this instance is equal to the specified FixedListByte64.
Declaration
public bool Equals(FixedListByte64 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte64 | other | The specified FixedListByte64 to compare with for equality |
Returns
Type | Description |
---|---|
Boolean |
GetEnumerator()
Returns an enumerator that iterates through a container.
Declaration
public FixedListByte4096.Enumerator GetEnumerator()
Returns
Type | Description |
---|---|
FixedListByte4096.Enumerator | An IEnumerator object that can be used to iterate through the container. |
GetHashCode()
Computes a hash code summary of the FixedListByte4096.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
Overrides
IndexOf(Byte)
Searches for the specified byte and returns the zero-based index of the first occurrence within the entire FixedListByte4096.
Declaration
public int IndexOf(byte item)
Parameters
Type | Name | Description |
---|---|---|
Byte | item | The byte to locate in the FixedListByte4096. |
Returns
Type | Description |
---|---|
Int32 |
IndexOf(Byte, Int32)
Searches for the specified byte and returns the zero-based index of the first occurrence within the range of elements in the FixedListByte4096 that starts at the specified index.
Declaration
public int IndexOf(byte item, int index)
Parameters
Type | Name | Description |
---|---|---|
Byte | item | The byte to locate in the FixedListByte4096. |
Int32 | index | The zero-based starting index of the search. 0 (zero) is valid in an empty list. |
Returns
Type | Description |
---|---|
Int32 |
IndexOf(Byte, Int32, Int32)
Searches for the specified byte and returns the zero-based index of the first occurrence within the range of elements in the FixedListByte4096 that starts at the specified index and contains the specified number of elements.
Declaration
public int IndexOf(byte item, int index, int count)
Parameters
Type | Name | Description |
---|---|---|
Byte | item | The byte to locate in the FixedListByte4096. |
Int32 | index | The zero-based starting index of the search. 0 (zero) is valid in an empty list. |
Int32 | count | The number of elements in the section to search. |
Returns
Type | Description |
---|---|
Int32 |
Insert(Int32, Byte)
Inserts a single element into a FixedListByte4096 at a specified zero-based index.
Declaration
public void Insert(int index, byte item)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index at which the new element should be inserted. |
Byte | item | The element to insert |
InsertRange(Int32, Int32)
Inserts a number of items into a FixedListByte4096 at a specified zero-based index.
Declaration
public void InsertRange(int begin, int end)
Parameters
Type | Name | Description |
---|---|---|
Int32 | begin | The zero-based index at which the new elements should be inserted. |
Int32 | end | The zero-based index just after where the elements should be removed. |
Remove(Byte)
Searches for the specified byte from the begining of the FixedListByte4096 forward, removes it if possible, and returns true if the byte was successfully removed.
Declaration
public bool Remove(byte item)
Parameters
Type | Name | Description |
---|---|---|
Byte | item | The byte to locate in the FixedListByte4096 |
Returns
Type | Description |
---|---|
Boolean |
RemoveAt(Int32)
Removes the byte at the specified index, and copies all subsequent elements backward to fill the hole so created.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index at which to remove the byte |
RemoveAtSwapBack(Int32)
Truncates the list by replacing the item at the specified index with the last item in the list. The list is shortened by one.
Declaration
public void RemoveAtSwapBack(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the item to delete. |
RemoveRange(Int32, Int32)
Truncates the list by removing the items at the specified index range, and shifting all remaining items to replace removed items. The list is shortened by number of elements in range.
Declaration
public void RemoveRange(int begin, int end)
Parameters
Type | Name | Description |
---|---|---|
Int32 | begin | The first index of the item to remove. |
Int32 | end | The index past-the-last item to remove. |
Remarks
This method of removing item(s) is useful only in case when list is ordered and user wants to preserve order
in list after removal In majority of cases is not important and user should use more performant RemoveRangeSwapBack
.
RemoveRangeSwapBack(Int32, Int32)
Truncates the list by replacing the item at the specified index range with the items from the end the list. The list is shortened by number of elements in range.
Declaration
public void RemoveRangeSwapBack(int begin, int end)
Parameters
Type | Name | Description |
---|---|---|
Int32 | begin | The first index of the item to remove. |
Int32 | end | The index past-the-last item to remove. |
RemoveSwapBack(Byte)
Removes the first occurrence of an item from the FixedListByte4096 and replaces it with the last element, which can be much faster than copying down all subsequent elements.
Declaration
public void RemoveSwapBack(byte item)
Parameters
Type | Name | Description |
---|---|---|
Byte | item | The elements to remove from the FixedListByte4096. |
Sort()
Sorts the elements in this FixedListByte4096.
Declaration
public void Sort()
ToArray()
Creates a managed Array of byte that is a copy of this FixedListByte4096.
Declaration
public byte[] ToArray()
Returns
Type | Description |
---|---|
Byte[] |
ToNativeArray(Allocator)
Creates an unmanaged NativeArraybyte that is a copy of this FixedListByte4096.
Declaration
public NativeArray<byte> ToNativeArray(Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
Allocator | allocator | A member of the Unity.Collections.Allocator enumeration. |
Returns
Type | Description |
---|---|
NativeArray<Byte> |
Operators
Equality(FixedListByte4096, FixedListByte128)
Determines whether a FixedListByte4096 and FixedListByte128 have the same value.
Declaration
public static bool operator ==(in FixedListByte4096 a, in FixedListByte128 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte4096 | a | The FixedListByte4096 to compare for equality |
FixedListByte128 | b | The FixedListByte128 to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedListByte4096, FixedListByte32)
Determines whether a FixedListByte4096 and FixedListByte32 have the same value.
Declaration
public static bool operator ==(in FixedListByte4096 a, in FixedListByte32 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte4096 | a | The FixedListByte4096 to compare for equality |
FixedListByte32 | b | The FixedListByte32 to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedListByte4096, FixedListByte4096)
Determines whether a FixedListByte4096 and FixedListByte4096 have the same value.
Declaration
public static bool operator ==(in FixedListByte4096 a, in FixedListByte4096 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte4096 | a | The FixedListByte4096 to compare for equality |
FixedListByte4096 | b | The FixedListByte4096 to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedListByte4096, FixedListByte512)
Determines whether a FixedListByte4096 and FixedListByte512 have the same value.
Declaration
public static bool operator ==(in FixedListByte4096 a, in FixedListByte512 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte4096 | a | The FixedListByte4096 to compare for equality |
FixedListByte512 | b | The FixedListByte512 to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedListByte4096, FixedListByte64)
Determines whether a FixedListByte4096 and FixedListByte64 have the same value.
Declaration
public static bool operator ==(in FixedListByte4096 a, in FixedListByte64 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte4096 | a | The FixedListByte4096 to compare for equality |
FixedListByte64 | b | The FixedListByte64 to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Implicit(FixedListByte128 to FixedListByte4096)
Implicitly converts a FixedListByte128 to a FixedListByte4096.
Declaration
public static implicit operator FixedListByte4096(in FixedListByte128 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte128 | other | The FixedListByte128 to copy |
Returns
Type | Description |
---|---|
FixedListByte4096 |
Implicit(FixedListByte32 to FixedListByte4096)
Implicitly converts a FixedListByte32 to a FixedListByte4096.
Declaration
public static implicit operator FixedListByte4096(in FixedListByte32 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte32 | other | The FixedListByte32 to copy |
Returns
Type | Description |
---|---|
FixedListByte4096 |
Implicit(FixedListByte512 to FixedListByte4096)
Implicitly converts a FixedListByte512 to a FixedListByte4096.
Declaration
public static implicit operator FixedListByte4096(in FixedListByte512 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte512 | other | The FixedListByte512 to copy |
Returns
Type | Description |
---|---|
FixedListByte4096 |
Implicit(FixedListByte64 to FixedListByte4096)
Implicitly converts a FixedListByte64 to a FixedListByte4096.
Declaration
public static implicit operator FixedListByte4096(in FixedListByte64 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte64 | other | The FixedListByte64 to copy |
Returns
Type | Description |
---|---|
FixedListByte4096 |
Inequality(FixedListByte4096, FixedListByte128)
Determines whether a FixedListByte4096 and FixedListByte128 have different values.
Declaration
public static bool operator !=(in FixedListByte4096 a, in FixedListByte128 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte4096 | a | The FixedListByte4096 to compare for inequality |
FixedListByte128 | b | The FixedListByte128 to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedListByte4096, FixedListByte32)
Determines whether a FixedListByte4096 and FixedListByte32 have different values.
Declaration
public static bool operator !=(in FixedListByte4096 a, in FixedListByte32 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte4096 | a | The FixedListByte4096 to compare for inequality |
FixedListByte32 | b | The FixedListByte32 to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedListByte4096, FixedListByte4096)
Determines whether a FixedListByte4096 and FixedListByte4096 have different values.
Declaration
public static bool operator !=(in FixedListByte4096 a, in FixedListByte4096 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte4096 | a | The FixedListByte4096 to compare for inequality |
FixedListByte4096 | b | The FixedListByte4096 to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedListByte4096, FixedListByte512)
Determines whether a FixedListByte4096 and FixedListByte512 have different values.
Declaration
public static bool operator !=(in FixedListByte4096 a, in FixedListByte512 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte4096 | a | The FixedListByte4096 to compare for inequality |
FixedListByte512 | b | The FixedListByte512 to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedListByte4096, FixedListByte64)
Determines whether a FixedListByte4096 and FixedListByte64 have different values.
Declaration
public static bool operator !=(in FixedListByte4096 a, in FixedListByte64 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListByte4096 | a | The FixedListByte4096 to compare for inequality |
FixedListByte64 | b | The FixedListByte64 to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |