Class Result
A class representing information about a "row" in the result of an IQuery
Inheritance
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 |
---|---|
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 |
Item[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 |
---|---|---|
System.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 |
---|---|
System.Collections.Generic.ICollection<System.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 |
---|---|---|
System.String | key | The key to check for |
Returns
Type | Description |
---|---|
System.Boolean |
|
GetArray(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 |
GetArray(String)
Gets the value of a given key as an IArray
Declaration
public ArrayObject GetArray(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to check the value for |
Returns
Type | Description |
---|---|
ArrayObject | The contained value, 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 |
GetBlob(String)
Gets the value of a given key as a Blob
Declaration
public Blob GetBlob(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to check the value for |
Returns
Type | Description |
---|---|
Blob | The contained value, 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
GetBoolean(String)
Gets the value of a given key as a System.Boolean
Declaration
public bool GetBoolean(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to check the value for |
Returns
Type | Description |
---|---|
System.Boolean | 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(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 |
GetDate(String)
Gets the value of a given key as a System.DateTimeOffset
Declaration
public DateTimeOffset GetDate(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to check the value for |
Returns
Type | Description |
---|---|
System.DateTimeOffset | The contained value, or a default value |
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 |
GetDictionary(String)
Gets the value of a given key as a readonly dictionary
Declaration
public DictionaryObject GetDictionary(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to check the value for |
Returns
Type | Description |
---|---|
DictionaryObject | The contained value, 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
GetDouble(String)
Gets the value of a given key as a System.Double
Declaration
public double GetDouble(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to check the value for |
Returns
Type | Description |
---|---|
System.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(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
GetFloat(String)
Gets the value of a given key as a System.Single
Declaration
public float GetFloat(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to check the value for |
Returns
Type | Description |
---|---|
System.Single | 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(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
GetInt(String)
Gets the value of a given key as an System.Int32
Declaration
public int GetInt(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to check the value for |
Returns
Type | Description |
---|---|
System.Int32 | The contained value, 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
GetLong(String)
Gets the value of a given key as an System.Int64
Declaration
public long GetLong(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to check the value for |
Returns
Type | Description |
---|---|
System.Int64 | The contained value, 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 |
GetString(String)
Gets the value of a given key as a System.String
Declaration
public string GetString(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to check the value for |
Returns
Type | Description |
---|---|
System.String | The contained value, 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
GetValue(String)
Gets the value of a given key as an untyped object
Declaration
public object GetValue(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to check the value for |
Returns
Type | Description |
---|---|
System.Object | The contained value, or |
Remarks
This method should be avoided for numeric types, whose underlying representation is subject to change and thus System.InvalidCastExceptions
ToDictionary()
Converts this object to a standard .NET string to object System.Collections.Generic.Dictionary<TKey, TValue>
Declaration
public Dictionary<string, object> ToDictionary()
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.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 |
---|---|
System.String | The contents of this object in JSON format string |
Exceptions
Type | Condition |
---|---|
System.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 |
---|---|
System.Collections.Generic.List<System.Object> | The contents of the array as a .NET list |
Explicit Interface Implementations
| Improve this Doc View SourceIEnumerable<KeyValuePair<String, Object>>.GetEnumerator()
Declaration
IEnumerator<KeyValuePair<string, object>> IEnumerable<KeyValuePair<string, object>>.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<System.String, System.Object>> |
IEnumerable<Object>.GetEnumerator()
Declaration
IEnumerator<object> IEnumerable<object>.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<System.Object> |
IEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |