Click here to Skip to main content
15,898,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi

I am new to the .net framework 3.5.
I had been programming in .net 2.0 and visual studio 2005.

I had extensively used the configurationmanager class (system.configuration) as follows:
C#
public string connectionString {
            get { 
                  if (_connectionString == null) 
                  { _connectionString = ConfigurationManager.ConnectionStrings[1].ToString();  }
                return _connectionString;  
                }
}

Now when I am using .netframework 3.5 & 2008, I dont see this class. How do I access the ConfigurationManager class in the system.configuration namespace. :((

Any help would be greatly appreciated

Regards
Posted
Updated 31-Jul-10 10:01am
v2

1 solution

Based on what you say, it sounds like you think there is no ConfigurationManager class anymore in .NetFrameword 3.5. If so, this is not correct. It does exists and has not been removed.

Have a look here: ConfigurationManager Class[^]

Might be you have not referenced System.Configuration.dll in your project. Once referenced the object does exists in System.Configuration
namespace. Try out.
 
Share this answer
 
Comments
RebornDeveloper 31-Jul-10 16:09pm    
Hi Sandeep

Thanks for your reply

You are right about the fact that i am making such an assumption.

Especially because I have put in the line using System.Configuration; in the class file in which i am trying to reference configurationmanager

Also, the target framework in my application is 3.5.

Any other inputs would be most welcome

Thanks
Bornagaindeveloper
Sandeep Mewara 31-Jul-10 16:25pm    
Well, the link that I shared confirms that it still exists, even in .Net 4.0.

Now, as per checklist:
1. Reference of the Syste.Configuration.dll to project (cross checking in the referenced dlls)
2. Either defining using namespace at top or using full classname(along with namespace) to create class object.
3. Even if intellisense doesn't say so, code it correctly and compile. See if you get any error. Might be that can help

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900