Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

need to create a custom class called Prefences.cs. I have done some things. Need someone to check it out.

Posted on 2009-02-16
12
Medium Priority
?
153 Views
Last Modified: 2012-05-06
<group name="Preferences">
          <add name="Theme" type="String" allowAnonymous="false"/>
          <add name="Culture" type="String" defaultValue="en-US"/>
        </group>

It will be called Preferences, how should i setup this object.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Profile;
 
/// <summary>
/// Summary description for Preferences
/// </summary>
[Serializable()]
public class Preferences
{
    public Preferences() { }
    public Preferences
    (
        string theme,
        string culture)
    {
        this.Theme = theme;
        this.Culture = culture;
    }
  
 
    private string theme = string.Empty;
    [SettingsAllowAnonymous(false)]
    public string Theme
    {
        get { return theme; }
        set { theme = value; }
    }
 
    private string culture = "en-US";
    public string Culture
    {
        get { return culture; }
        set { culture = value; }
    }
}

Open in new window

0
Comment
Question by:mathieu_cupryk
  • 8
  • 4
12 Comments
 
LVL 16

Expert Comment

by:burakiewicz
ID: 23651240
what version of VS and framework are you using?
0
 

Author Comment

by:mathieu_cupryk
ID: 23651482
visual 2008 and frame work 3.5
0
 
LVL 16

Accepted Solution

by:
burakiewicz earned 2000 total points
ID: 23651561
with 3.5 you can do it this way you just need to add
using System.Configuration;
[Serializable]
    public class Preferences
    {
        public Preferences() { }
        public Preferences(string theme,string culture)
        {
            this.Theme = theme;
            this.Culture = culture;
        }
        
        [SettingsAllowAnonymous(false)]
        public string Theme { get; set; }
        [DefaultSettingValue("en-US")]
        public string Culture{get;set;}
    }

Open in new window

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:mathieu_cupryk
ID: 23651581
how come the get and set are like this?
0
 

Author Comment

by:mathieu_cupryk
ID: 23651603
for the namespace configuration  this is for  [DefaultSettingValue("en-US")]

0
 

Author Comment

by:mathieu_cupryk
ID: 23651622
can u help me with this question aswell.
0
 
LVL 16

Expert Comment

by:burakiewicz
ID: 23651658
the get and set are like that because with the 3.5 you dont need to declare the members the compiler will generate those for you.shorter for developers
0
 

Author Comment

by:mathieu_cupryk
ID: 23651688
there is another question related i have not seen anyone able to answer this?
http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_24146900.html
0
 
LVL 16

Expert Comment

by:burakiewicz
ID: 23651805
ok give me a little bit and i can look at both of them
0
 

Author Comment

by:mathieu_cupryk
ID: 23651850
i would appreciate your opinion. it seems u know what you are doing.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question