Namespace with managed C++ DLL and C# usage

  • Thread starter Thread starter Mr Topom
  • Start date Start date
M

Mr Topom

Hi,

Just a simple question :

I have a managed C++ dll;
I want to use it in a C# application.
So I added : #using MyAssembly.SubAssembly; (which is the assembly in
the DLL)

But when I want to use my class : MyAssembly.SubAssembly.Klass, I need
to put all the namespace and the class name alone is not recognized...

Any idea why ?

Thx
 
I have a managed C++ dll;
I want to use it in a C# application.
So I added : #using MyAssembly.SubAssembly; (which is the assembly in
the DLL)

ahh... you mean #using "MyAssembly.SubAssembly.DLL"?
But when I want to use my class : MyAssembly.SubAssembly.Klass, I need
to put all the namespace and the class name alone is not recognized...

Any idea why ?

Sure. You just referenced the assembly, not the namespace (which has nothing
to do with it). If you want to avoid specifying the namespace everytime,
then just add a using namespace directive as well:

using namespace MyAssembly::SubAssembly;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top