Show / Hide Table of Contents

    Class AppControl.ExtraDataCollection

    Class for extra data.

    Inheritance
    Object
    AppControl.ExtraDataCollection
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: Tizen.Applications
    Assembly: Tizen.Applications.Common.dll
    Syntax
    public class ExtraDataCollection

    Methods

    Add(String, IEnumerable<String>)

    Adds extra data.

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

    The name of the extra data.

    IEnumerable<String> value

    The value associated with the given key.

    Remarks

    The function replaces any existing value for the given key.

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

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

    ArgumentException

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

    Add(String, String)

    Adds extra data.

    Declaration
    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.

    API Version
    3
    Examples
    AppControl appControl = new AppControl();
    appControl.ExtraData.Add("myKey", "myValue");
    Exceptions
    Type Condition
    ArgumentNullException

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

    ArgumentException

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

    Count()

    Counts keys in the extra data.

    Declaration
    public int Count()
    Returns
    Type Description
    Int32

    The number of counting keys.

    API Version
    3
    Examples
    AppControl appControl = new AppControl();
    int numberOfKeys = appControl.ExtraData.Count();
    Exceptions
    Type Condition
    InvalidOperationException

    Thrown when the key is an invalid parameter.

    Get(String)

    Gets the extra data.

    Declaration
    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.

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

    Thrown when the key is an invalid parameter.

    KeyNotFoundException

    Thrown when the key is not found.

    ArgumentException

    Thrown when the key is rejected.

    Get<T>(String)

    Gets the extra data.

    Declaration
    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>

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

    Thrown when the key is an invalid parameter.

    KeyNotFoundException

    Thrown when the key is not found.

    ArgumentException

    Thrown when the key is rejected.

    GetKeys()

    Gets all keys in extra data.

    Declaration
    public IEnumerable<string> GetKeys()
    Returns
    Type Description
    IEnumerable<String>

    The keys in the AppControl.

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

    Thrown when the key is an invalid parameter.

    IsCollection(String)

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

    Declaration
    public bool IsCollection(string key)
    Parameters
    Type Name Description
    String key

    The name of the extra data.

    Returns
    Type Description
    Boolean

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

    API Version
    3
    Examples
    AppControl appControl = new AppControl();
    bool result = appControl.ExtraData.IsCollection("myKey");
    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when the key is a zero-length string.

    InvalidOperationException

    Thrown when failed to check the key.

    Remove(String)

    Removes the extra data.

    Declaration
    public void Remove(string key)
    Parameters
    Type Name Description
    String key

    The name of the extra data.

    API Version
    3
    Examples
    AppControl appControl = new AppControl();
    appControl.ExtraData.Remove("myKey");
    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when the key is a zero-length string.

    KeyNotFoundException

    Thrown when the key is not found.

    ArgumentException

    Thrown when the key is rejected.

    TryGet(String, out IEnumerable<String>)

    Tries getting the extra data.

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

    The name of extra data.

    IEnumerable<String> value

    The value associated with the given key.

    Returns
    Type Description
    Boolean

    The result whether getting the value is done.

    API Version
    3
    Examples
    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
    ArgumentNullException

    Thrown when the key is an invalid parameter.

    KeyNotFoundException

    Thrown when the key is not found.

    ArgumentException

    Thrown when the key is rejected.

    TryGet(String, out String)

    Tries getting the extra data.

    Declaration
    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
    Boolean

    The result whether getting the value is done.

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

    Thrown when the key is an invalid parameter.

    KeyNotFoundException

    Thrown when the key is not found.

    ArgumentException

    Thrown when the key is rejected.

    Back to top Copyright © 2016-2018 Samsung
    Generated by DocFX