473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

'System.Configuration.ConfigurationSettings.AppSet tings' is obsolete !!

In trying to get the C# conversion code for Head First Design Patterns
to work I came accross a number of warnings. e.g.

Warning
Number: 10
Description: 'System.Configuration.ConfigurationSettings.AppSet tings'
is obsolete: 'This method is obsolete, it has been replaced by
System.Configuration!System.Configuration.Configur ationManager.AppSettings'
E:\code\HeadFirstDesignPatternsInCSharp\Decorator. Starbuzz\Expresso.cs
Line: 31
Col: 30
Project: Decorator.Starbuzz

How do I fix it?

The file includes "System.Configuration", but when I write
ConfigurationManager I don't see the usual object there. How do I fix
this?
Here is the example offending file: Expresso.cs

using System;
using System.Configuration;

namespace HeadFirstDesignPatterns.Decorator.Starbuzz
{
/// <summary>
/// Summary description for Expresso.
/// </summary>
public class Expresso: Beverage
{
public Expresso()
{}

public override double Cost()
{
return GetSize(base.Size);
}

public override string GetDescription()
{
return "Expresso";
}

private double GetSize(BeverageSize size)
{
switch(size)
{
case BeverageSize.TALL:
return
Convert.ToDouble(ConfigurationSettings.AppSettings["ExpressoSizeTall"]);
case BeverageSize.GRANDE:
return
Convert.ToDouble(ConfigurationSettings.AppSettings["ExpressoSizeGrande"]);
case BeverageSize.VENTI:
return
Convert.ToDouble(ConfigurationSettings.AppSettings["ExpressoSizeVenti"]);
default:
return 1.50;
}
}
}
}
Jul 15 '07 #1
2 5309

If yours is a web application, try the following:

using System;
using System.Configuration;
using System.Web.Configuration;

In lieu of
ConfigurationSettings.AppSettings["myFunkyKey"]);
try
WebConfigurationManager.AppSettings["myFunkyKey"];
Jul 15 '07 #2

"mark4asp" <ma******@gmail.comwrote in message
news:cv********************************@4ax.com...
In trying to get the C# conversion code for Head First Design Patterns
to work I came accross a number of warnings. e.g.

Warning
Number: 10
Description: 'System.Configuration.ConfigurationSettings.AppSet tings'
is obsolete: 'This method is obsolete, it has been replaced by
System.Configuration!System.Configuration.Configur ationManager.AppSettings'
E:\code\HeadFirstDesignPatternsInCSharp\Decorator. Starbuzz\Expresso.cs
Line: 31
Col: 30
Project: Decorator.Starbuzz

How do I fix it?
using System.Configuration;

ConfigurationManager.AppSettings

There is a System.Web.Configuration for Web configuration.

Jul 15 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: runningdog | last post by:
HI, Sorry if this is a bit long winded I'm working on a suite of winapps that need to use two levels of configuration data; application level and solution level. I found a reference on MSDN...
6
by: Tony | last post by:
Dear All, When I run an example program on the http://www.dotnetjunkies.com/quickstart/util/srcview.aspx?path=/quickstart/aspplus/samples/webforms/data/datagrid1.src&file=VB\datagrid1.aspx&font=3 ...
1
by: Patrick | last post by:
When Tracing in ASP.NET, the IIS process (on IIs5.1) is locking on the Trace file, and I can't read the trace file without restarting the IIS: Even the following does NOT work (how could I fix...
4
by: RSH | last post by:
Hi, I have a situation where I am attempting to print the contents of an AppSettings property in the aspx file of my website. Basically here is the code I am using: <% Response.Write("Email:"...
5
by: Joe Reiss | last post by:
Using vs2005, C# I'm writing some code to settings out of my app.config file. I seemed to be missing many fields from System.Configuration. For example System.Configuration.Configuration will...
3
by: Jyothi Kumar | last post by:
Hi, my project is a migrated project from VS 2003 to VS 2005, in this project I used System.Configuration.ConfigurationSettings.AppSettings, now in VS 2005 it is giving a warning Message like:...
2
by: Randy Smith | last post by:
Hi ALL, I am getting this strange warning message, and I can't seem to find any solution for it. 'System.Configuration.CofigurationSettings.AppSettings is obsolete: it has been replaced by...
1
by: =?Utf-8?B?Vmlua2k=?= | last post by:
I keep getting this warining in my code, but when i tried to look at the intellisense after system.configuration. , I couldn't find configurationManager but when i forced to put...
2
by: pantagruel | last post by:
Hi, I have a Visual studio 2005 project that runs as a Windows Service. In it I have declared that I am using System.Configuration. I have set one application setting for the service using the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.