Custom application setting

Discussion in 'C#' started by cygnusX, Oct 8, 2007.

  1. cygnusX

    cygnusX New Member

    Joined:
    Oct 8, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    How to make a custom application setting?I mean i want to serialize Hashtable but AFAIK that can't be done in Settings.Designer.cs and therefore must be done in separate class.But i don't know how to access the setting in that new class from other classes where i need to use the setting.The default application settings are accessed like this Properties.Settings.Default.... but what about the custom settings?Here is the new setting class...

    Code:
    using System;
    using System.Configuration;
    using System.Collections.Generic;
    
    namespace Properties
    {
    internal sealed class servers : ApplicationSettingsBase
    {
    [ApplicationScopedSetting()]
    [SettingsSerializeAs(System.Configuration.SettingsSerializeAs.Binary)]
    [DefaultSettingValue(@"")]
    public System.Collections.Hashtable ServersHashtable
    {
    get
    {
    return ((System.Collections.Hashtable)this["ServersHashtable"]);
    }
    set
    {
    this["ServersHashtable"] = (System.Collections.Hashtable)value;
    }
    }
    }
    }
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice