mk.helpers
Search Results for

    Show / Hide Table of Contents

    Class StaticData

    A static class for managing and retrieving static data stored in a dictionary.

    Inheritance
    object
    StaticData
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: mk.helpers
    Assembly: mk.helpers.dll
    Syntax
    public static class StaticData

    Methods

    Add(Dictionary<string, string>)

    Adds a dictionary of key-value pairs to the static data dictionary.

    Declaration
    public static void Add(Dictionary<string, string> data)
    Parameters
    Type Name Description
    Dictionary<string, string> data

    A dictionary of key-value pairs to be added.

    Add(KeyValuePair<string, string>[])

    Adds an array of key-value pairs to the static data dictionary.

    Declaration
    public static void Add(KeyValuePair<string, string>[] keyValuePairs)
    Parameters
    Type Name Description
    KeyValuePair<string, string>[] keyValuePairs

    An array of key-value pairs to be added.

    Add(string, string)

    Adds or updates a key-value pair in the static data dictionary.

    Declaration
    public static void Add(string key, string value)
    Parameters
    Type Name Description
    string key

    The key of the data.

    string value

    The value of the data.

    AddObject<T>(string, T)

    Adds or updates an object of type T in the static data dictionary.

    Declaration
    public static void AddObject<T>(string key, T value) where T : class
    Parameters
    Type Name Description
    string key

    The key of the data.

    T value

    The object value to be added.

    Type Parameters
    Name Description
    T

    The type of object to be added.

    Get(string)

    Retrieves the value associated with the specified key from the static data dictionary.

    Declaration
    public static string Get(string key)
    Parameters
    Type Name Description
    string key

    The key of the data to retrieve.

    Returns
    Type Description
    string

    The value associated with the specified key, or null if the key does not exist.

    GetBoolean(string)

    Retrieves the Boolean value associated with the specified key from the static data dictionary.

    Declaration
    public static bool GetBoolean(string key)
    Parameters
    Type Name Description
    string key

    The key of the data to retrieve.

    Returns
    Type Description
    bool

    The Boolean value associated with the specified key, or false if the key does not exist or is not a valid Boolean.

    GetDecimal(string)

    Retrieves the Decimal value associated with the specified key from the static data dictionary.

    Declaration
    public static decimal? GetDecimal(string key)
    Parameters
    Type Name Description
    string key

    The key of the data to retrieve.

    Returns
    Type Description
    decimal?

    The Decimal value associated with the specified key, or null if the key does not exist or is not a valid Decimal.

    GetInt(string)

    Retrieves the integer value associated with the specified key from the static data dictionary.

    Declaration
    public static int? GetInt(string key)
    Parameters
    Type Name Description
    string key

    The key of the data to retrieve.

    Returns
    Type Description
    int?

    The integer value associated with the specified key, or null if the key does not exist or is not a valid integer.

    GetInt16(string)

    Retrieves the Int16 value associated with the specified key from the static data dictionary.

    Declaration
    public static short? GetInt16(string key)
    Parameters
    Type Name Description
    string key

    The key of the data to retrieve.

    Returns
    Type Description
    short?

    The Int16 value associated with the specified key, or null if the key does not exist or is not a valid Int16.

    GetInt32(string)

    Retrieves the Int32 value associated with the specified key from the static data dictionary.

    Declaration
    public static int? GetInt32(string key)
    Parameters
    Type Name Description
    string key

    The key of the data to retrieve.

    Returns
    Type Description
    int?

    The Int32 value associated with the specified key, or null if the key does not exist or is not a valid Int32.

    GetInt64(string)

    Retrieves the Int64 value associated with the specified key from the static data dictionary.

    Declaration
    public static long? GetInt64(string key)
    Parameters
    Type Name Description
    string key

    The key of the data to retrieve.

    Returns
    Type Description
    long?

    The Int64 value associated with the specified key, or null if the key does not exist or is not a valid Int64.

    GetObject<T>(string)

    Retrieves the object of type T associated with the specified key from the static data dictionary.

    Declaration
    public static T GetObject<T>(string key) where T : class
    Parameters
    Type Name Description
    string key

    The key of the data to retrieve.

    Returns
    Type Description
    T

    The object of type T associated with the specified key, or null if the key does not exist or if deserialization fails.

    Type Parameters
    Name Description
    T

    The type of object to retrieve.

    In this article
    Back to top mk.helpers - MIT License