I am trying to work with some C# namespaces from managed c++. The namespaces
use a dot notation and generates a compiler error. Is there a way around
this?
#using "csharpassembly.dll"//has the namespace test and namespace
test.external under it.
void test()
{
test::test.external::class1* p = new test::test.external::class1()
;//error C2039- test is not a member of test.
}
>I am trying to work with some C# namespaces from managed c++. The
>namespaces
[quoted text clipped - 9 lines]
> ;//error C2039- test is not a member of test.
> }
dot notation is for C#.
for C++ you use :: like you would normally do.
notation has nothing to do with the namespaces themselves.
it is just a way of saying 'this namespace is a member of that namespace'
do it like this:
test::test::external::class1* p = new test::test::external::class1() ;

Signature
Kind regards,
Bruno van Dooren
bruno_nos_pam_van_dooren@hotmail.com
Remove only "_nos_pam"
PGP - 14 Jun 2006 21:30 GMT
>>I am trying to work with some C# namespaces from managed c++. The
>>namespaces
[quoted text clipped - 18 lines]
> do it like this:
> test::test::external::class1* p = new test::test::external::class1() ;
Bruno,
Thanks for the quick reply. That works.
Another question...
In C# a namespace declaration can use dots
namespace CompanyName.System.Foo {
How might one code this in C++?
matthew breedlove - 30 Jun 2006 16:11 GMT
> Another question...
>
[quoted text clipped - 3 lines]
>
> How might one code this in C++?
namespace CompanyName { namespace System { namespace Foo {
class Test {
};
}}}
I don't really know of a better way to accomplish this, but I'm open to
suggestions if anyone knows of a better solution.
mike - 30 Jun 2006 17:24 GMT
Heh, exactly where I am. Thanks.