Interface IDictionaryObject
An interface representing a readonly key-value collection with type-safe accessors
Inherited Members
Namespace: Couchbase.Lite
Assembly: Couchbase.Lite.dll
Syntax
[JsonConverter(typeof(IDictionaryObjectConverter))]
public interface IDictionaryObject : IDictionaryFragment, IEnumerable<KeyValuePair<string, object>>, IEnumerable
Properties
| Improve this Doc View SourceCount
Gets the number of entries in this dictionary
Declaration
int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Keys
Gets all the keys held by this dictionary
Declaration
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
bool Contains(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to check for |
Returns
Type | Description |
---|---|
System.Boolean |
|
GetArray(String)
Gets the value of a given key as an IArray
Declaration
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(String)
Gets the value of a given key as a Blob
Declaration
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(String)
Gets the value of a given key as a System.Boolean
Declaration
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(String)
Gets the value of a given key as a System.DateTimeOffset
Declaration
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(String)
Gets the value of a given key as a readonly dictionary
Declaration
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(String)
Gets the value of a given key as a System.Double
Declaration
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(String)
Gets the value of a given key as a System.Single
Declaration
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(String)
Gets the value of a given key as an System.Int32
Declaration
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(String)
Gets the value of a given key as an System.Int64
Declaration
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(String)
Gets the value of a given key as a System.String
Declaration
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(String)
Gets the value of a given key as an untyped object
Declaration
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
Dictionary<string, object> ToDictionary()
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.Object> | The contents of this object as a .NET dictionary |