Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Namespace same as class name = declaration head aches 1

Status
Not open for further replies.

dalchri

Programmer
Apr 19, 2002
608
US
I have an order entry app that I have divided into three UI, Data, and Business tiers. The root namespace is named Order. These namespaces are as follows:

Code:
namespace Order.Business {
   class Order {
      //Business logic here
   }
}
namespace Order.Data {
   class Order {
      //Database interaction and queries here
   }
}
namespace Order.Interface {
   class Order : System.Windows.Form {
      //User interface for working with an order
   }
}

The problem that I have is in trying to reference the business order class from inside the user interface:
Code:
//This is inside Order.Interface.Order
Order.Business.Order m_busOrder = new Order.Business.Order();

The compiler is confused as to whether I am tring to reference a static method called Business in the Order.Interface.Order class or if I am trying to declare an Order.Business.Order class.

Does anyone know if there is a special delimiter or some such trivia in the lexicography of C# that indicates you are talking about a namespace and not a class or some shorthand for the root or default namespace?

For example something along the lines of
[Order.Business].Order
or
_Order.Business.Order???
 
I would change the name. If you must have "Order" as a namespace maybe be should be "Orders". You probably should call your namespace "Business" then have classes under it "Order", "PurchaseOrder:Order" etc.. Also calling a namespace "Interface" is like calling a "class": "Class" or a "method": "Method", it's not a good idea (IMHO) ...
 
When in doubt, follow Micorsoft's naming recommendations on
MSDN


Jeff
The future is already here - it's just not widely distributed yet...
 
Yeah, I wouldn't do that. Pick another name for your class or your namespace.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top