Class ArrayObject
A class representing a readonly ordered collection of objects
Implements
Inherited Members
Namespace: Couchbase.Lite
Assembly: Couchbase.Lite.dll
Syntax
public class ArrayObject : IArray, IArrayFragment, IEnumerable<object>, IEnumerable
Properties
| Improve this Doc View SourceCount
Gets the number of elements in this array
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Item[Int32]
Gets the value of the given index, or lack thereof, wrapped inside of a IFragment
Declaration
public IFragment this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index to check |
Property Value
Type | Description |
---|---|
IFragment | The value of the given index, or lack thereof |
Methods
| Improve this Doc View SourceGetArray(Int32)
Gets the value at the given index as a read only array
Declaration
public ArrayObject GetArray(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index to lookup |
Returns
Type | Description |
---|---|
ArrayObject | The value at the index, or |
GetBlob(Int32)
Gets the value at the given index as a Blob
Declaration
public Blob GetBlob(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index to lookup |
Returns
Type | Description |
---|---|
Blob | The value at the index, or |
GetBoolean(Int32)
Gets the value at the given index as a System.Boolean
Declaration
public bool GetBoolean(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index to lookup |
Returns
Type | Description |
---|---|
System.Boolean | The value at the index, or its converted equivalent |
Remarks
Any non-zero object will be treated as true, so don't rely on any sort of parsing
GetDate(Int32)
Gets the value at the given index as a System.DateTimeOffset
Declaration
public DateTimeOffset GetDate(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index to lookup |
Returns
Type | Description |
---|---|
System.DateTimeOffset | The value at the index, or a default |
GetDictionary(Int32)
Gets the value at the given index as a DictionaryObject
Declaration
public DictionaryObject GetDictionary(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index to lookup |
Returns
Type | Description |
---|---|
DictionaryObject | The value at the index, or |
GetDouble(Int32)
Gets the value at the given index as a System.Double
Declaration
public double GetDouble(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index to lookup |
Returns
Type | Description |
---|---|
System.Double | The value at the index, or its converted equivalent |
Remarks
true
will be converted to 1.0, and everything else that
is non-numeric will be 0.0
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public virtual IEnumerator<object> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<System.Object> | An enumerator that can be used to iterate through the collection. |
GetFloat(Int32)
Gets the value at the given index as a System.Single
Declaration
public float GetFloat(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index to lookup |
Returns
Type | Description |
---|---|
System.Single | The value at the index, or its converted equivalent |
Remarks
true
will be converted to 1.0f, and everything else that
is non-numeric will be 0.0f
GetInt(Int32)
Gets the value at the given index as an System.Int32
Declaration
public int GetInt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index to lookup |
Returns
Type | Description |
---|---|
System.Int32 | The value at the index, or its converted equivalent |
Remarks
true
will be converted to 1, a System.Double value
will be rounded, and everything else non-numeric will be 0
GetLong(Int32)
Gets the value at the given index as an System.Int64
Declaration
public long GetLong(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index to lookup |
Returns
Type | Description |
---|---|
System.Int64 | The value at the index, or its converted equivalent |
Remarks
true
will be converted to 1, a System.Double value
will be rounded, and everything else non-numeric will be 0
GetString(Int32)
Gets the value at the given index as a System.String
Declaration
public string GetString(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index to lookup |
Returns
Type | Description |
---|---|
System.String | The value at the index, or |
GetValue(Int32)
Gets the value at the given index as an untyped object
Declaration
public object GetValue(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index to lookup |
Returns
Type | Description |
---|---|
System.Object | The value at the index, or |
Remarks
This method should be avoided for numeric types, whose underlying representation is subject to change and thus System.InvalidCastExceptions
ToList()
Similar to the LINQ method, but returns all objects converted to standard .NET types
Declaration
public List<object> ToList()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.Object> | A list of standard .NET typed objects in the array |
ToMutable()
Creates a copy of this object that can be mutated
Declaration
public MutableArrayObject ToMutable()
Returns
Type | Description |
---|---|
MutableArrayObject | A mutable copy of the array |
Explicit Interface Implementations
| Improve this Doc View SourceIEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |