Class ResourceQuery
Definition
- Namespace:
- Tizen.Network.IoTConnectivity
- Assembly:
- Tizen.Network.IoTConnectivity.dll
This class provides APIs to manage the query of request.
[Obsolete("Deprecated since API level 13")]
public class ResourceQuery : IDictionary<string, string>, ICollection<KeyValuePair<string, string>>, IEnumerable<KeyValuePair<string, string>>, IEnumerable, IDisposable
- Inheritance
-
objectResourceQuery
- Implements
-
System.Collections.Generic.IDictionary<TKey, TValue><string, string>System.Collections.Generic.ICollection<T><System.Collections.Generic.KeyValuePair<TKey, TValue><string, string>>System.Collections.Generic.IEnumerable<T><System.Collections.Generic.KeyValuePair<TKey, TValue><string, string>>System.Collections.IEnumerableSystem.IDisposable
Constructors
View SourceResourceQuery()
The resource query constructor.
Declaration
[Obsolete("Deprecated since API level 13")]
public ResourceQuery()
Examples
ResourceQuery query = new ResourceQuery();
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the iotcon is not supported. |
System.OutOfMemoryException | Thrown when there is not enough memory. |
See Also
Properties
View SourceCount
Gets the number of query elements.
Declaration
[Obsolete("Deprecated since API level 13")]
public int Count { get; }
Property Value
Type | Description |
---|---|
int | The number of query elements. |
Examples
ResourceQuery query = new ResourceQuery();
query.Add("key", "value");
query.Add("newKey", "sample value");
var count = query.Count;
Console.WriteLine("There are {0} keys in the query object", count);
View Source
Interface
Gets and sets the resource interface of the query.
Declaration
[Obsolete("Deprecated since API level 13")]
public string Interface { get; set; }
Property Value
Type | Description |
---|---|
string | The resource interface of the query. Setter value could be a value, such as DefaultInterface. |
Examples
ResourceQuery query = new ResourceQuery();
query.Interface = ResourceInterfaces.LinkInterface;
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the iotcon is not supported. |
System.ArgumentException | Thrown when there is an invalid parameter. |
System.InvalidOperationException | Thrown when the operation is invalid. |
IsReadOnly
Represents whether the collection is readonly.
Declaration
[Obsolete("Deprecated since API level 13")]
public bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
bool | Whether the collection is readonly. |
Examples
ResourceQuery query = new ResourceQuery();
if (query.IsReadOnly)
Console.WriteLine("Read only query");
View Source
this[string]
Gets or sets the query data.
Declaration
[Obsolete("Deprecated since API level 13")]
public string this[string key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
string | key | The query key to get or set. |
Property Value
Type | Description |
---|---|
string | The query data. |
Examples
ResourceQuery query = new ResourceQuery();
query["key1"] = "sample-data";
Console.WriteLine("query has : {0}", query["key1"]);
View Source
Keys
Contains all the query keys.
Declaration
[Obsolete("Deprecated since API level 13")]
public ICollection<string> Keys { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.ICollection<T><string> | All the query keys. |
Examples
ResourceQuery query = new ResourceQuery();
query.Add("key", "value");
query.Add("newKey", "sample value");
var keys = query.Keys;
Console.WriteLine("Resource query contains keys {0} and {1}", keys.ElementAt(0), keys.ElementAt(1));
View Source
Type
Gets and sets the resource type of the query.
Declaration
[Obsolete("Deprecated since API level 13")]
public string Type { get; set; }
Property Value
Type | Description |
---|---|
string | The resource type of the query. |
Examples
ResourceQuery query = new ResourceQuery();
query.Type = "org.tizen.light";
Console.WriteLine("Type of query : {0}", query.Type);
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the iotcon is not supported. |
System.ArgumentException | Thrown when there is an invalid parameter. |
System.InvalidOperationException | Thrown when the operation is invalid. |
Values
Contains all the query values.
Declaration
[Obsolete("Deprecated since API level 13")]
public ICollection<string> Values { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.ICollection<T><string> | All the query values. |
Examples
ResourceQuery query = new ResourceQuery();
query.Add("key", "value");
query.Add("newKey", "sample value");
var values = query.Values;
Console.WriteLine("Resource query contains values {0} and {1}", values.ElementAt(0), values.ElementAt(1));
Methods
View SourceAdd(KeyValuePair<string, string>)
Adds a query key and a value as a key value pair.
Declaration
[Obsolete("Deprecated since API level 13")]
public void Add(KeyValuePair<string, string> item)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<TKey, TValue><string, string> | item | The key value pair. |
Examples
ResourceQuery query = new ResourceQuery();
query.Add(new KeyValuePair<string, string>("key1", "value1"));
See Also
View SourceAdd(string, string)
Adds a new key and correspoding value into the query.
Declaration
[Obsolete("Deprecated since API level 13")]
public void Add(string key, string value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the query to insert. |
string | value | The string data to insert into the query. |
Remarks
The full length of query should be less than or equal to 64.
Examples
ResourceQuery query = new ResourceQuery();
query.Add("key1", "value1");
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the iotcon is not supported. |
System.ArgumentException | Thrown when there is an invalid parameter. |
System.InvalidOperationException | Thrown when the operation is invalid. |
See Also
View SourceClear()
Clears the query collection.
Declaration
[Obsolete("Deprecated since API level 13")]
public void Clear()
Examples
ResourceQuery query = new ResourceQuery();
query.Add("key1", "value1");
query.Add("key2", "value2");
query.Clear();
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the iotcon is not supported. |
System.InvalidOperationException | Thrown when the operation is invalid. |
Contains(KeyValuePair<string, string>)
Checks if the given query pair exists.
Declaration
[Obsolete("Deprecated since API level 13")]
public bool Contains(KeyValuePair<string, string> item)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<TKey, TValue><string, string> | item | The key value pair. |
Returns
Type | Description |
---|---|
bool | True if exists. Otherwise, false. |
Examples
ResourceQuery query = new ResourceQuery();
query.Add(new KeyValuePair<string, string>("key1", "value1"));
var isPresent = query.Contains(new KeyValuePair<string, string>("key1", "value1"));
if (isPresent)
Console.WriteLine("Key value pair is present");
View Source
ContainsKey(string)
Checks whether the given key exists in the query collection.
Declaration
[Obsolete("Deprecated since API level 13")]
public bool ContainsKey(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key to look for. |
Returns
Type | Description |
---|---|
bool | true if exists. Otherwise, false. |
Examples
ResourceQuery query = new ResourceQuery();
query.Add("key1", "value1");
if (query.ContainsKey("key1"))
Console.WriteLine("query conatins key : key1");
View Source
CopyTo(KeyValuePair<string, string>[], int)
Copies the elements of the query collection to an array, starting at a particular index.
Declaration
[Obsolete("Deprecated since API level 13")]
public void CopyTo(KeyValuePair<string, string>[] array, int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<TKey, TValue><string, string>[] | array | The destination array. |
int | arrayIndex | Index parameter. |
Examples
ResourceQuery query = new ResourceQuery();
query.Add(new KeyValuePair<string, string>("key1", "value1"));
KeyValuePair<string, string>[] dest = new KeyValuePair<string, string>[query.Count];
query.CopyTo(dest, 0);
Console.WriteLine("Dest conatins ({0}, {1})", dest[0].Key, dest[0].Value);
View Source
Dispose()
Releases any unmanaged resources used by this object.
Declaration
[Obsolete("Deprecated since API level 13")]
public void Dispose()
Dispose(bool)
Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
Declaration
[Obsolete("Deprecated since API level 13")]
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | If true, disposes any disposable objects. If false, does not dispose disposable objects. |
~ResourceQuery()
Destructor of the ResourceQuery class.
Declaration
protected ~ResourceQuery()
GetEnumerator()
Gets the enumerator to the query collection.
Declaration
[Obsolete("Deprecated since API level 13")]
public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<T><System.Collections.Generic.KeyValuePair<TKey, TValue><string, string>> | Enumerator to query pairs. |
Examples
ResourceQuery query = new ResourceQuery();
query.Add(new KeyValuePair<string, string>("key1", "value1"));
query.Add(new KeyValuePair<string, string>("key2", "value2"));
foreach (KeyValuePair<string, string> pair in query)
{
Console.WriteLine("key : {0}, value : {1}", pair.Key, pair.Value);
}
View Source
Remove(KeyValuePair<string, string>)
Removes the given key value pair from the query.
Declaration
[Obsolete("Deprecated since API level 13")]
public bool Remove(KeyValuePair<string, string> item)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<TKey, TValue><string, string> | item | The key value pair to remove. |
Returns
Type | Description |
---|---|
bool | True if operation is successful. Otherwise, false. |
Examples
ResourceQuery query = new ResourceQuery();
query.Add(new KeyValuePair<string, string>("key1", "value1"));
var result = query.Remove(new KeyValuePair<string, string>("key1", "value1"));
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when there is an invalid parameter. |
See Also
View SourceRemove(string)
Removes the key and its associated value from the query.
Declaration
[Obsolete("Deprecated since API level 13")]
public bool Remove(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The ID of the query to delete. |
Returns
Type | Description |
---|---|
bool | True if operation is successful. Otherwise, false. |
Examples
ResourceQuery query = new ResourceQuery();
query.Add("key1", "value1");
var result = query.Remove("key1");
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the iotcon is not supported. |
System.ArgumentException | Thrown when there is an invalid parameter. |
System.InvalidOperationException | Thrown when the operation is invalid. |
See Also
View SourceTryGetValue(string, out string)
Gets the value associated with the specified key.
Declaration
[Obsolete("Deprecated since API level 13")]
public bool TryGetValue(string key, out string value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The query key. |
string | value | Value corresponding to query key. |
Returns
Type | Description |
---|---|
bool | True if the key exists, false otherwise. |
Examples
ResourceQuery query = new ResourceQuery();
query.Add("key1", "value1");
string value;
var isPresent = query.TryGetValue("key1", out value);
if (isPresent)
Console.WriteLine("value : {0}", value);
Explicit Interface Implementations
View SourceIEnumerable.GetEnumerator()
Gets the enumerator to the query collection.
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator | The enumerator to the query pairs. |
Examples
ResourceQuery query = new ResourceQuery();
query.Add(new KeyValuePair<string, string>("key1", "value1"));
query.Add(new KeyValuePair<string, string>("key2", "value2"));
foreach (KeyValuePair<string, string> pair in query)
{
Console.WriteLine("key : {0}, value : {1}", pair.Key, pair.Value);
}