On Sep 18, 12:46*pm, AA2e72E <AA2e...@discussions.microsoft.com>
wrote:
With
using System.Configuration
why is ConfigurationManager.AppSettings["my"]
generate an error?
Why does the error resolve itself when, in addition to the using directive,
I add a reference to System.Configuration?
Because "using" directive is not the same as adding a reference.
Questions:
1. I understood that the using directive made the assembly available: when
does it not do so?
It never does that. "using" deals strictly with namespaces - it allows
you to access members of the designated namespace without fully
qualifying them. It knows nothing about assemblies at all. For
example, all your C# programs reference "mscorlib.dll", which is the
assembly where e.g. System.Console lives, regardless of whether you
have "using System" in your code, or not.
2. What does Add Reference do (beyond using)?
It references the specified assembly, allowing you to use the types
within it - nothing less, nothing more.