Wednesday, November 09, 2005
Deprecated stuff in C# 2.0
I just spent a half hour rewriting my emailing code to use the new System.Net.Mail namespace instead of System.Web.Mail ( so now we have System.Web and System.Net, that's not confusing at all ). I'm a real fan of 0 warnings on my projects. Now all my warnings are the same:
Warning 1 'System.Configuration.ConfigurationSettings.AppSettings' is obsolete: 'This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings'
Now, I copied some examples out of MSDN, but the System.Configuration.ConfigurationManager class doesn't actually seem to exist, at least not according to my compiler ( the same one that tells me off for using the 'old' System.Configuration.ConfigurationManager class. )
How can the IDE know that I should be using a class that does not exist ?
Warning 1 'System.Configuration.ConfigurationSettings.AppSettings' is obsolete: 'This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings'
Now, I copied some examples out of MSDN, but the System.Configuration.ConfigurationManager class doesn't actually seem to exist, at least not according to my compiler ( the same one that tells me off for using the 'old' System.Configuration.ConfigurationManager class. )
How can the IDE know that I should be using a class that does not exist ?
Comments:
<< Home
I don't know, I've always taken System.Web to mean dealing with websites. System.Net could be any internet-based communication and supporting classes: sockets, web requests, file requests; things dealing with networks that are not tied to web applications. It seems most of the web application stuff is in System.Web, most of the network-related stuff is in System.Net.
The System.Configuration.ConfigurationManager class exists, but only in the System.Configuration.dll. If you forgot to add a reference to that dll in your project, the compiler will complain the method is missing.
The System.Configuration.ConfigurationManager class exists, but only in the System.Configuration.dll. If you forgot to add a reference to that dll in your project, the compiler will complain the method is missing.
OK - I thought of that, but I assumed that if I can see the System.Configuration classes, I must have everything I need imported. I guess with partial classes they can add to the namespace in a new dll, for some reason or other.
Actually, I think they could do it before as well; you could define a namespace and a class in one dll (say, in System.dll), then fill in optional stuff in that same namespace in another dll. In fact, I recall this being the case with lots of .NET Remoting stuff in .NET 1.x; you've got some basic, lightweight stuff in System.Runtime.Remoting namespace, and you'll see that if you reference System.dll. But if you want to get at things like TcpChannel and other .NET Remoting channels, you'd have to reference System.Runtime.Remoting.dll.
I noticed they did this with some WebBrowserPermisson as well, which is inside the System.Windows.Forms namespace, but defined in the System.dll (see this MSDN doc for more info).
I noticed they did this with some WebBrowserPermisson as well, which is inside the System.Windows.Forms namespace, but defined in the System.dll (see this MSDN doc for more info).
Hey Christian.. I think System.Configuration.dll should be added to the project to have that.... :) :)
Post a Comment
<< Home