Class Result
A class representing information about a "row" in the result of an IQuery
Implements
Inherited Members
Namespace: Couchbase.Lite.Query
Assembly: Couchbase.Lite.dll
Syntax
public sealed class Result : IArray, IArrayFragment, IEnumerable<object>, IDictionaryObject, IDictionaryFragment, IEnumerable<KeyValuePair<string, object>>, IEnumerable, IJSON
Properties
| Improve this Doc View SourceCount
Gets the number of entries in the result
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| int |
this[int]
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 |
|---|---|---|
| int | index | The index to check |
Property Value
| Type | Description |
|---|---|
| IFragment | The value of the given index, or lack thereof |
this[string]
Gets the value of the given key, or lack thereof, wrapped inside of a IFragment
Declaration
public IFragment this[string key] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key to check |
Property Value
| Type | Description |
|---|---|
| IFragment | The value of the given key, or lack thereof |
Keys
Gets all the keys held by this dictionary
Declaration
public ICollection<string> Keys { get; }
Property Value
| Type | Description |
|---|---|
| ICollection<string> |
Methods
| Improve this Doc View SourceContains(string)
Checks if a given key is present in the dictionary
Declaration
public bool Contains(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key to check for |
Returns
| Type | Description |
|---|---|
| bool |
|
GetArray(int)
Gets the value at the given index as a read only array
Declaration
public ArrayObject GetArray(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The index to lookup |
Returns
| Type | Description |
|---|---|
| ArrayObject | The value at the index, or |
GetArray(string)
Gets the value of a given key as an IArray
Declaration
public ArrayObject GetArray(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key to check the value for |
Returns
| Type | Description |
|---|---|
| ArrayObject | The contained value, or |
GetBlob(int)
Gets the value at the given index as a Blob
Declaration
public Blob GetBlob(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The index to lookup |
Returns
| Type | Description |
|---|---|
| Blob | The value at the index, or |
GetBlob(string)
Gets the value of a given key as a Blob
Declaration
public Blob GetBlob(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key to check the value for |
Returns
| Type | Description |
|---|---|
| Blob | The contained value, or |
GetBoolean(int)
Gets the value at the given index as a bool
Declaration
public bool GetBoolean(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The index to lookup |
Returns
| Type | Description |
|---|---|
| bool | 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
GetBoolean(string)
Gets the value of a given key as a bool
Declaration
public bool GetBoolean(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key to check the value for |
Returns
| Type | Description |
|---|---|
| bool | The contained value, or its converted equivalent |
Remarks
Any non-zero object will be treated as true, so don't rely on any sort of parsing
GetDate(int)
Gets the value at the given index as a DateTimeOffset
Declaration
public DateTimeOffset GetDate(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The index to lookup |
Returns
| Type | Description |
|---|---|
| DateTimeOffset | The value at the index, or a default |
GetDate(string)
Gets the value of a given key as a DateTimeOffset
Declaration
public DateTimeOffset GetDate(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key to check the value for |
Returns
| Type | Description |
|---|---|
| DateTimeOffset | The contained value, or a default value |
GetDictionary(int)
Gets the value at the given index as a DictionaryObject
Declaration
public DictionaryObject GetDictionary(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The index to lookup |
Returns
| Type | Description |
|---|---|
| DictionaryObject | The value at the index, or |
GetDictionary(string)
Gets the value of a given key as a readonly dictionary
Declaration
public DictionaryObject GetDictionary(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key to check the value for |
Returns
| Type | Description |
|---|---|
| DictionaryObject | The contained value, or |
GetDouble(int)
Gets the value at the given index as a double
Declaration
public double GetDouble(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The index to lookup |
Returns
| Type | Description |
|---|---|
| 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
GetDouble(string)
Gets the value of a given key as a double
Declaration
public double GetDouble(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key to check the value for |
Returns
| Type | Description |
|---|---|
| double | The contained value, or its converted equivalent |
Remarks
true will be converted to 1.0, and everything else that
is non-numeric will be 0.0
GetFloat(int)
Gets the value at the given index as a float
Declaration
public float GetFloat(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The index to lookup |
Returns
| Type | Description |
|---|---|
| float | 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
GetFloat(string)
Gets the value of a given key as a float
Declaration
public float GetFloat(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key to check the value for |
Returns
| Type | Description |
|---|---|
| float | The contained value, or its converted equivalent |
Remarks
true will be converted to 1.0f, and everything else that
is non-numeric will be 0.0f
GetInt(int)
Gets the value at the given index as an int
Declaration
public int GetInt(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The index to lookup |
Returns
| Type | Description |
|---|---|
| int | The value at the index, or its converted equivalent |
Remarks
true will be converted to 1, a double value
will be rounded, and everything else non-numeric will be 0
GetInt(string)
Gets the value of a given key as an int
Declaration
public int GetInt(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key to check the value for |
Returns
| Type | Description |
|---|---|
| int | The contained value, or its converted equivalent |
Remarks
true will be converted to 1, a double value
will be rounded, and everything else non-numeric will be 0
GetLong(int)
Gets the value at the given index as an long
Declaration
public long GetLong(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The index to lookup |
Returns
| Type | Description |
|---|---|
| long | The value at the index, or its converted equivalent |
Remarks
true will be converted to 1, a double value
will be rounded, and everything else non-numeric will be 0
GetLong(string)
Gets the value of a given key as an long
Declaration
public long GetLong(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key to check the value for |
Returns
| Type | Description |
|---|---|
| long | The contained value, or its converted equivalent |
Remarks
true will be converted to 1, a double value
will be rounded, and everything else non-numeric will be 0
GetString(int)
Gets the value at the given index as a string
Declaration
public string GetString(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The index to lookup |
Returns
| Type | Description |
|---|---|
| string | The value at the index, or |
GetString(string)
Gets the value of a given key as a string
Declaration
public string GetString(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key to check the value for |
Returns
| Type | Description |
|---|---|
| string | The contained value, or |
GetValue(int)
Gets the value at the given index as an untyped object
Declaration
public object GetValue(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The index to lookup |
Returns
| Type | Description |
|---|---|
| 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 InvalidCastExceptions
GetValue(string)
Gets the value of a given key as an untyped object
Declaration
public object GetValue(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key to check the value for |
Returns
| Type | Description |
|---|---|
| object | The contained value, or |
Remarks
This method should be avoided for numeric types, whose underlying representation is subject to change and thus InvalidCastExceptions
ToDictionary()
Converts this object to a standard .NET string to object Dictionary<TKey, TValue>
Declaration
public Dictionary<string, object> ToDictionary()
Returns
| Type | Description |
|---|---|
| Dictionary<string, object> | The contents of this object as a .NET dictionary |
ToJSON()
Converts this object to JSON format string.
Declaration
public string ToJSON()
Returns
| Type | Description |
|---|---|
| string | The contents of this object in JSON format string |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown if ToJSON is called from MutableDocument, |
ToList()
Converts the contents of the array to a .NET list type
Declaration
public List<object> ToList()
Returns
| Type | Description |
|---|---|
| List<object> | The contents of the array as a .NET list |