Struct ActionSegment<T>
ActionSegment{T} is a data structure that allows access to a segment of an underlying array
in order to avoid the copying and allocation of sub-arrays. The segment is defined by
the offset into the original array, and an length.
Syntax
public struct ActionSegment<T> : IEnumerable<T>, IEnumerable, IEquatable<ActionSegment<T>> where T : struct
Type Parameters
Name |
Description |
T |
The type of object stored in the underlying Array
|
Constructors
ActionSegment(T[])
Declaration
public ActionSegment(T[] actionArray)
Parameters
Type |
Name |
Description |
T[] |
actionArray |
The action array to use for the this segment.
|
ActionSegment(T[], Int32, Int32)
Construct an ActionSegment<T> with an underlying array
and offset, and a length.
Declaration
public ActionSegment(T[] actionArray, int offset, int length)
Parameters
Type |
Name |
Description |
T[] |
actionArray |
The underlying array which this segment has a view into
|
Int32 |
offset |
The zero-based offset into the underlying array.
|
Int32 |
length |
The length of the segment.
|
Fields
Empty
An Empty segment which has an offset of 0, a Length of 0, and it's underlying array
is also empty.
Declaration
public static ActionSegment<T> Empty
Field Value
Length
The number of items this segment can access in the underlying array.
Declaration
public readonly int Length
Field Value
Offset
The zero-based offset into the original array at which this segment starts.
Declaration
public readonly int Offset
Field Value
Properties
Array
Get the underlying Array of this segment.
Declaration
public T[] Array { get; }
Property Value
Item[Int32]
Allows access to the underlying array using array syntax.
Declaration
public T this[int index] { get; set; }
Parameters
Type |
Name |
Description |
Int32 |
index |
The zero-based index of the segment.
|
Property Value
Exceptions
Methods
Clear()
Sets the segment of the backing array to all zeros.
Declaration
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
Object |
obj |
|
Returns
Overrides
Equals(ActionSegment<T>)
Declaration
public bool Equals(ActionSegment<T> other)
Parameters
Returns
Implements
GetEnumerator()
Declaration
public IEnumerator GetEnumerator()
Returns
Implements
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Overrides
Explicit Interface Implementations
IEnumerable<T>.GetEnumerator()
Declaration
IEnumerator<T> IEnumerable<T>.GetEnumerator()
Returns
Implements
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.