using System;
namespace System
{
/// Delimits a section of a one-dimensional array.
/// The type of the elements in the array segment.
/// 2
// Token: 0x0200063B RID: 1595
[Serializable]
public struct ArraySegment
{
/// Initializes a new instance of the structure that delimits the specified range of the elements in the specified array.
/// The array containing the range of elements to delimit.
/// The zero-based index of the first element in the range.
/// The number of elements in the range.
///
/// is null.
///
/// or is less than 0.
///
/// and do not specify a valid range in .
// Token: 0x06003B28 RID: 15144 RVA: 0x000C9BA4 File Offset: 0x000C7DA4
public ArraySegment(T[] array, int offset, int count)
{
if (array == null)
{
throw new ArgumentNullException("array");
}
if (offset < 0)
{
throw new ArgumentOutOfRangeException("offset", "Non-negative number required.");
}
if (count < 0)
{
throw new ArgumentOutOfRangeException("count", "Non-negative number required.");
}
if (offset > array.Length)
{
throw new ArgumentException("out of bounds");
}
if (array.Length - offset < count)
{
throw new ArgumentException("out of bounds", "offset");
}
this.array = array;
this.offset = offset;
this.count = count;
}
/// Initializes a new instance of the structure that delimits all the elements in the specified array.
/// The array to wrap.
///
/// is null.
// Token: 0x06003B29 RID: 15145 RVA: 0x000C9C34 File Offset: 0x000C7E34
public ArraySegment(T[] array)
{
if (array == null)
{
throw new ArgumentNullException("array");
}
this.array = array;
this.offset = 0;
this.count = array.Length;
}
/// Gets the original array containing the range of elements that the array segment delimits.
/// The original array that was passed to the constructor, and that contains the range delimited by the .
/// 1
// Token: 0x17000B54 RID: 2900
// (get) Token: 0x06003B2A RID: 15146 RVA: 0x000C9C6C File Offset: 0x000C7E6C
public T[] Array
{
get
{
return this.array;
}
}
/// Gets the position of the first element in the range delimited by the array segment, relative to the start of the original array.
/// The position of the first element in the range delimited by the , relative to the start of the original array.
/// 1
// Token: 0x17000B55 RID: 2901
// (get) Token: 0x06003B2B RID: 15147 RVA: 0x000C9C74 File Offset: 0x000C7E74
public int Offset
{
get
{
return this.offset;
}
}
/// Gets the number of elements in the range delimited by the array segment.
/// The number of elements in the range delimited by the .
/// 1
// Token: 0x17000B56 RID: 2902
// (get) Token: 0x06003B2C RID: 15148 RVA: 0x000C9C7C File Offset: 0x000C7E7C
public int Count
{
get
{
return this.count;
}
}
/// Determines whether the specified object is equal to the current instance.
/// true if the specified object is a structure and is equal to the current instance; otherwise, false.
/// The object to be compared with the current instance.
// Token: 0x06003B2D RID: 15149 RVA: 0x000C9C84 File Offset: 0x000C7E84
public override bool Equals(object obj)
{
return obj is ArraySegment && this.Equals((ArraySegment)obj);
}
/// Determines whether the specified structure is equal to the current instance.
/// true if the specified structure is equal to the current instance; otherwise, false.
/// The structure to be compared with the current instance.
// Token: 0x06003B2E RID: 15150 RVA: 0x000C9CA0 File Offset: 0x000C7EA0
public bool Equals(ArraySegment obj)
{
return this.array == obj.Array && this.offset == obj.Offset && this.count == obj.Count;
}
/// Returns the hash code for the current instance.
/// A 32-bit signed integer hash code.
// Token: 0x06003B2F RID: 15151 RVA: 0x000C9CDC File Offset: 0x000C7EDC
public override int GetHashCode()
{
return this.array.GetHashCode() ^ this.offset ^ this.count;
}
/// Indicates whether two structures are equal.
/// true if is equal to ; otherwise, false.
/// The structure on the left side of the equality operator.
/// The structure on the right side of the equality operator.
// Token: 0x06003B30 RID: 15152 RVA: 0x000C9CF8 File Offset: 0x000C7EF8
public static bool operator ==(ArraySegment a, ArraySegment b)
{
return a.Equals(b);
}
/// Indicates whether two structures are unequal.
/// true if is not equal to ; otherwise, false.
/// The structure on the left side of the inequality operator.
/// The structure on the right side of the inequality operator.
// Token: 0x06003B31 RID: 15153 RVA: 0x000C9D04 File Offset: 0x000C7F04
public static bool operator !=(ArraySegment a, ArraySegment b)
{
return !a.Equals(b);
}
// Token: 0x040017A7 RID: 6055
private T[] array;
// Token: 0x040017A8 RID: 6056
private int offset;
// Token: 0x040017A9 RID: 6057
private int count;
}
}