Question about Namespaces

  • Thread starter Thread starter cmay
  • Start date Start date
C

cmay

The other day I was working with a 3rd party assembly.

Lets say that all the classes from this assembly were under the
namespace:

3rdParty.Components.MathLibrary

Now, I wanted to write a few quick structs/classes that would help to
better represent some of the classes in the
3rdParty.Components.MathLibrary, they were going to basically be
facades or wrappers or whatever.

I thought it would be easier to logically group these classes within
the 3rdParty.Components.MathLibaray namespace, but when I tried to
declare that same namespace for some of my classes, I lost the ability
to use any of the code from the real 3rdParty.Components.MathLibrary.

Is there no way to do what I was trying to achieve? I know I could
(and did) just build the classes in my own namespace, but the classes I
wrote were ones that I found "missing" in the provided assembly, and
they didn't really belong with what I was working on b/c they were
specific to the assembly.

Why is this not allowed?
 
cmay said:
The other day I was working with a 3rd party assembly.

Lets say that all the classes from this assembly were under the
namespace:

3rdParty.Components.MathLibrary

Now, I wanted to write a few quick structs/classes that would help to
better represent some of the classes in the
3rdParty.Components.MathLibrary, they were going to basically be
facades or wrappers or whatever.

I thought it would be easier to logically group these classes within
the 3rdParty.Components.MathLibaray namespace, but when I tried to
declare that same namespace for some of my classes, I lost the ability
to use any of the code from the real 3rdParty.Components.MathLibrary.

Is there no way to do what I was trying to achieve? I know I could
(and did) just build the classes in my own namespace, but the classes I
wrote were ones that I found "missing" in the provided assembly, and
they didn't really belong with what I was working on b/c they were
specific to the assembly.

Why is this not allowed?

It is, as far as I'm aware.

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
 
Jon,

I was actually writing this app in VB.net. When I went to code up an
example in C# it worked just fine.
I figured the C# newsgroups would be better to post to about namespaces
than the VB ones, but maybe this is something have VB just can't do,
and C# can.

What I mean is this code does NOT work in VB.NET. It will not compile
b/c it can't find the "RotatorDesigner" class.

Is this a known thing that VB.Net can't do?

using System;
using ComponentArt.Web.UI.Design;


namespace ClassLibrary1
{
public class Class1
{
ComponentArt.Web.UI.Design.RotatorDesigner X;
ComponentArt.Web.UI.Design.MyTestClass Y;

public Class1()
{
}
}
}

namespace ComponentArt.Web.UI.Design
{
public class MyTestClass
{
public MyTestClass()
{

}
}
}



Could you post a short but complete program which demonstrates the
problem?
 
cmay said:
I was actually writing this app in VB.net. When I went to code up an
example in C# it worked just fine.
I figured the C# newsgroups would be better to post to about namespaces
than the VB ones, but maybe this is something have VB just can't do,
and C# can.

What I mean is this code does NOT work in VB.NET. It will not compile
b/c it can't find the "RotatorDesigner" class.

Is this a known thing that VB.Net can't do?

I don't know, to be honest. I suggest you ask in the VB.NET newsgroup -
they're likely to know there.
 
Back
Top