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>, IIndexable<byte>, IEnumerable<byte>, 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.
IsEmpty
Reports whether container is empty.
Declaration
public bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
Boolean | True if this container empty. |
Implements
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
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(in byte item)
Parameters
Type | Name | Description |
---|---|---|
Byte | item | The byte to be added at the end of the list. |
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. |
AddRange(Void*, Int32)
Adds elements from a buffer to this list.
Declaration
public void AddRange(void *ptr, int length)
Parameters
Type | Name | Description |
---|---|---|
Void* | ptr | A pointer to the buffer. |
Int32 | length | The number of elements to add to the list. |
AddRangeNoResize(Void*, Int32)
Adds elements from a buffer to this list.
Declaration
public void AddRangeNoResize(void *ptr, int length)
Parameters
Type | Name | Description |
---|---|---|
Void* | ptr | A pointer to the buffer. |
Int32 | length | The number of elements to add to the list. |
Clear()
Clears the list.
Declaration
public void Clear()
Implements
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 |
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 |
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 |
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 |
InsertRangeWithBeginEnd(Int32, Int32)
Inserts a number of items into a FixedListByte4096 at a specified zero-based index.
Declaration
public void InsertRangeWithBeginEnd(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 | Returns true if item is removed. |
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 index, int count)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The first index of the item to remove. |
Int32 | count | The number of elements 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 index, int count)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The first index of the item to remove. |
Int32 | count | The number of elements to remove. |
RemoveRangeSwapBackWithBeginEnd(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 RemoveRangeSwapBackWithBeginEnd(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. |
RemoveRangeWithBeginEnd(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 RemoveRangeWithBeginEnd(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 RemoveRangeSwapBackWithBeginEnd
.
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 bool RemoveSwapBack(byte item)
Parameters
Type | Name | Description |
---|---|---|
Byte | item | The elements to remove from the FixedListByte4096. |
Returns
Type | Description |
---|---|
Boolean | Returns true if item is removed. |
Sort()
Sorts the elements in this FixedListByte4096 in ascending order.
Declaration
public void Sort()
Sort<U>(U)
Sorts the elements in this FixedListByte4096 using a custom comparison function.
Declaration
public void Sort<U>(U comp)
where U : IComparer<byte>
Parameters
Type | Name | Description |
---|---|---|
U | comp | A comparison function that indicates whether one element in the array is less than, equal to, or greater than another element. |
Type Parameters
Name | Description |
---|---|
U | The comparer type. |
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 |