This is a bad title for the question, but I'm not quite sure of a better one.
I have a namespace called Globals with a class X in it. I also have a class called Globals. When I try to access Globals.X.StaticMember it tries to access the class Globals.X and complains that X doesn't exist. How do I reference the namespace Globals - ie ::Globals.X.StaticMember (:: doesn't compile).
Classes are data types. They are an expanded concept of structures, they can contain data members, but they can also contain functions as members whereas a namespace is simply an abstract way of grouping items together. A namespace cannot be created as an object; think of it more as a naming convention.
Web. services namespace is a initial point for creating the web services. It contains web service classes , which allow to create XML web services using Asp.Net . XML web services provides feature to exchange messages in loosely coupled environment.
Try global::Globals.X.StaticMember
.
And Globals are Evil!
Eric Lippert recently blogged about it. Four blog posts no less, check it out. Start at part one.
Eric Lippert recently had a series of blogposts describing the problems you run into when using the same name for a class and a namespace, explaining this statement from the Framework Design Guidelines in section 3.4:
“do not use the same name for a namespace and a type in that namespace”.
See here for the various posts:
Do not name a class the same as its namespace (Part 1, Part 2, Part 3, Part 4)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With