Problem on defining Multiple Level Namespace (Company::Application::Components)

  • Thread starter Thread starter Sai Kit Tong
  • Start date Start date
S

Sai Kit Tong

How can I define a multiple level namespace for my class?

I got compilation error using the "::" as separator:

namespace MyCompany::GenericApp::CommComponent
{
public __gc class WordReader
{
..........
}
}

However, I could define MyCompany.GenericApp.CommComponent on C#.
 
How can I define a multiple level namespace for my class?
I got compilation error using the "::" as separator:
namespace MyCompany::GenericApp::CommComponent
{
public __gc class WordReader
{
..........
}
}
However, I could define MyCompany.GenericApp.CommComponent on C#.

Try

namespace MyCompany { namespace GenericApp { namespace CommComponent {
public __gc class WordReader
{
..........
};
}}} // MyCompany::GenericApp::CommComponent

HTH,
Tim
 
Hello Sai Kit,

Thanks for posting in the group.

Based on my understanding, now the issue is: How to define multiple level
namespace in VC.NET programming?

Tim has provided the resolution to it. I tested it on my side and it works
fine. For an example, if I create a C# client, after adding reference to
that DLL and add "using ***", we can call that class as:
MyCompany.GenericApp.CommComponent.Word Reader a = new
MyCompany.GenericApp.CommComponent.Word Reader();

If you have any more concerns on it, please feel free to post here.

By the way, we could send post notify emails to you when there are useful
replies for your post in the newsgroup. If you want to receive it in the
future, please register your no spam email alias at:
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hello Sai Kit,

How are things going? If you have any questions or concerns on implementing
muliple level namespace, please don't hesitate to let me know. I am happy
to be of assistance.

Thanks for participating the community.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
I also have tried this and failed but I have a further problems.

My .NET control will no longer open in the Design window if I have more
that one level of namespace as you suggested
(CompanyName::Technology::ComponentGrouping) .
It gives the error: "The designer could not be shown for this file
because none of the classes within it can be designed."

Why does it complain - the code is legal C++? Is this a known problem?
It doesn't appear on the knowledge base.

I have found a workaround using a preprocessor macro to collapse the
namespaces for the designer but that causes a flow-on hassle, the
control ends up with the wrong full name in the toolbox. Oh well.
 
Hi Peter,

This may be related to another bug we have in this area (that we fail if you
try to put the control in the global namespace). I'll add this to that bug
so we can track this for the Whidbey release.

Ronald Laeremans
Visual C++ team
 
Cheers, and thanks

This may be related to another bug we have in this area (that we fail if you
try to put the control in the global namespace). I'll add this to that bug
so we can track this for the Whidbey release.
--
If you whish to reply to me directly, my addres is spam proofed as:

pbromley at adi dot co dot nz

Or if you prefer - (e-mail address removed) :-)
 
Back
Top