Class AppControl.ExtraDataCollection

Definition

Namespace:
Tizen.Applications
Assembly:
Tizen.Applications.Common.dll

Class for extra data.

C#
Copy
public class AppControl.ExtraDataCollection
Inheritance
object
AppControl.ExtraDataCollection

Methods

View Source

Add(string, IEnumerable<string>)

Adds extra data.

Declaration
C#
Copy
public void Add(string key, IEnumerable<string> value)
Parameters
Type Name Description
string key

The name of the extra data.

System.Collections.Generic.IEnumerable<T><string> value

The value associated with the given key.

Remarks

The function replaces any existing value for the given key.

Examples
Copy
AppControl appControl = new AppControl(); string[] myValues = new string[] { "first", "second", "third" }; appControl.ExtraData.Add("myKey", myValues);
Exceptions
Type Condition
System.ArgumentNullException

Thrown when key or value is a zero-length string.

System.ArgumentException

Thrown when the application tries to use the same key with the system-defined key.

View Source

Add(string, string)

Adds extra data.

Declaration
C#
Copy
public void Add(string key, string value)
Parameters
Type Name Description
string key

The name of the extra data.

string value

The value associated with the given key.

Remarks

The function replaces any existing value for the given key.

Examples
Copy
AppControl appControl = new AppControl(); appControl.ExtraData.Add("myKey", "myValue");
Exceptions
Type Condition
System.ArgumentNullException

Thrown when a key or a value is a zero-length string.

System.ArgumentException

Thrown when the application tries to use the same key with the system-defined key.

View Source

Count()

Counts keys in the extra data.

Declaration
C#
Copy
public int Count()
Returns
Type Description
int

The number of counting keys.

Examples
Copy
AppControl appControl = new AppControl(); int numberOfKeys = appControl.ExtraData.Count();
Exceptions
Type Condition
System.InvalidOperationException

Thrown when the key is an invalid parameter.

View Source

Get(string)

Gets the extra data.

Declaration
C#
Copy
public object Get(string key)
Parameters
Type Name Description
string key

The name of extra data.

Returns
Type Description
object

The value associated with the given key.

Examples
Copy
AppControl appControl = new AppControl(); string myValue = appControl.ExtraData.Get("myKey") as string; if (myValue != null) { // ... }
Exceptions
Type Condition
System.ArgumentNullException

Thrown when the key is an invalid parameter.

System.Collections.Generic.KeyNotFoundException

Thrown when the key is not found.

System.ArgumentException

Thrown when the key is rejected.

View Source

Get<T>(string)

Gets the extra data.

Declaration
C#
Copy
public T Get<T>(string key)
Parameters
Type Name Description
string key

The name of extra data.

Returns
Type Description
T

The value associated with the given key.

Type Parameters
Name Description
T

Only string and IEnumerable<string>

Examples
Copy
AppControl appControl = new AppControl(); string myValue = appControl.ExtraData.Get<string>("myKey");
Exceptions
Type Condition
System.ArgumentNullException

Thrown when the key is an invalid parameter.

System.Collections.Generic.KeyNotFoundException

Thrown when the key is not found.

System.ArgumentException

Thrown when the key is rejected.

View Source

GetKeys()

Gets all keys in extra data.

Declaration
C#
Copy
public IEnumerable<string> GetKeys()
Returns
Type Description
System.Collections.Generic.IEnumerable<T><string>

The keys in the AppControl.

Examples
Copy
AppControl appControl = new AppControl(); IEnumerable<string> keys = appControl.GetKeys(); if (keys != null) { foreach (string key in keys) { // ... } }
Exceptions
Type Condition
System.InvalidOperationException

Thrown when the key is an invalid parameter.

View Source

IsCollection(string)

Checks whether the extra data associated with the given key is of the collection data type.

Declaration
C#
Copy
public bool IsCollection(string key)
Parameters
Type Name Description
string key

The name of the extra data.

Returns
Type Description
bool

If true, the extra data is of the array data type, otherwise false.

Examples
Copy
AppControl appControl = new AppControl(); bool result = appControl.ExtraData.IsCollection("myKey");
Exceptions
Type Condition
System.ArgumentNullException

Thrown when the key is a zero-length string.

System.InvalidOperationException

Thrown when failed to check the key.

View Source

Remove(string)

Deletes a particular piece of extra data from the collection.

Declaration
C#
Copy
public void Remove(string key)
Parameters
Type Name Description
string key

Identifier of the data to remove.

Remarks

This method enables removal of individual items from the ExtraData collection. It accepts only non-empty strings as valid input parameters.

Examples
Copy
AppControl appControl = new AppControl(); appControl.ExtraData.Remove("myKey");
Exceptions
Type Condition
System.ArgumentNullException

Thrown when the key is a zero-length string.

System.Collections.Generic.KeyNotFoundException

Thrown when the key is not found.

System.ArgumentException

Thrown when the key is rejected.

View Source

TryGet(string, out IEnumerable<string>)

Tries getting the extra data.

Declaration
C#
Copy
public bool TryGet(string key, out IEnumerable<string> value)
Parameters
Type Name Description
string key

The name of extra data.

System.Collections.Generic.IEnumerable<T><string> value

The value associated with the given key.

Returns
Type Description
bool

The result whether getting the value is done.

Examples
Copy
AppControl appControl = new AppControl(); IEnumerable<string> myValue = null; bool result = appControl.ExtraData.TryGet("myKey", out myValue); if (result) { foreach (string value in myValue) { // ... } }
Exceptions
Type Condition
System.ArgumentNullException

Thrown when the key is an invalid parameter.

System.Collections.Generic.KeyNotFoundException

Thrown when the key is not found.

System.ArgumentException

Thrown when the key is rejected.

View Source

TryGet(string, out string)

Tries getting the extra data.

Declaration
C#
Copy
public bool TryGet(string key, out string value)
Parameters
Type Name Description
string key

The name of extra data.

string value

The value associated with the given key.

Returns
Type Description
bool

The result whether getting the value is done.

Examples
Copy
AppControl appControl = new AppControl(); string myValue = string.Empty; bool result = appControl.ExtraData.TryGet("myKey", out myValue); if (result != null) { // ... }
Exceptions
Type Condition
System.ArgumentNullException

Thrown when the key is an invalid parameter.

System.Collections.Generic.KeyNotFoundException

Thrown when the key is not found.

System.ArgumentException

Thrown when the key is rejected.