473,569 Members | 2,542 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Global namespace problem in .NET

I already asked this question in the VB.NET group but as C# seems to have the
same problem, I'll try here, too.

I have 2 external OEM assemblies A1 and A2 that both define class X (same
name, not same class) in the global namespace. I need to use both X'es in my
project. How do I fully qualify the X'es to avoid the name clash between X
from A1 and X from A2.

The using statement provides a way of aliasing clashing names from named
namespaces but it does NOT give the possibility to resolve name clashes in
the global namespace. Or is it possible?

Any bright minds out there who have a solution?

Otherwise, this seems to be a serious problem with .NET languages. I hope
somebody from Microsoft sees this and gets this problem fixed.

Nov 17 '05 #1
4 5375
How large is the surface area of each of your OEM assemblies? Could you
create namespaced proxies for them?

Please shoot the supplier of any assemblies using global types. It might
seem excessive now, but unless we stop these people reproducing, they'll
keep at it.

--
Regards,

Tim Haughton

Agitek
http://agitek.co.uk
http://blogitek.com/timhaughton

"anders" <an****@discuss ions.microsoft. com> wrote in message
news:1E******** *************** ***********@mic rosoft.com...
I already asked this question in the VB.NET group but as C# seems to have the same problem, I'll try here, too.

I have 2 external OEM assemblies A1 and A2 that both define class X (same
name, not same class) in the global namespace. I need to use both X'es in my project. How do I fully qualify the X'es to avoid the name clash between X
from A1 and X from A2.

The using statement provides a way of aliasing clashing names from named
namespaces but it does NOT give the possibility to resolve name clashes in
the global namespace. Or is it possible?

Any bright minds out there who have a solution?

Otherwise, this seems to be a serious problem with .NET languages. I hope
somebody from Microsoft sees this and gets this problem fixed.

Nov 17 '05 #2
Shooting people is hardly the solution to this problem. Inevitably there will
be clashes in the global name space even when you use namespaces. The
outermost namespace of every assembly is in the global scope and a name clash
is always possible so there should be a mechanism of resolving them!

How would you create a namespaced proxy?

"Tim Haughton" wrote:
How large is the surface area of each of your OEM assemblies? Could you
create namespaced proxies for them?

Please shoot the supplier of any assemblies using global types. It might
seem excessive now, but unless we stop these people reproducing, they'll
keep at it.

--
Regards,

Tim Haughton

Agitek
http://agitek.co.uk
http://blogitek.com/timhaughton

"anders" <an****@discuss ions.microsoft. com> wrote in message
news:1E******** *************** ***********@mic rosoft.com...
I already asked this question in the VB.NET group but as C# seems to have

the
same problem, I'll try here, too.

I have 2 external OEM assemblies A1 and A2 that both define class X (same
name, not same class) in the global namespace. I need to use both X'es in

my
project. How do I fully qualify the X'es to avoid the name clash between X
from A1 and X from A2.

The using statement provides a way of aliasing clashing names from named
namespaces but it does NOT give the possibility to resolve name clashes in
the global namespace. Or is it possible?

Any bright minds out there who have a solution?

Otherwise, this seems to be a serious problem with .NET languages. I hope
somebody from Microsoft sees this and gets this problem fixed.


Nov 17 '05 #3
"anders" <an****@discuss ions.microsoft. com> wrote in message
news:EB******** *************** ***********@mic rosoft.com...
Shooting people is hardly the solution to this problem.
No, it isn't. But it will help prevent the problem from recurring, and will
also make you feel a lot better.
Inevitably there will
be clashes in the global name space even when you use namespaces. The
outermost namespace of every assembly is in the global scope and a name clash is always possible so there should be a mechanism of resolving them!
I've been developing in C# for over 4 years now and have never encountered a
single naming clash. But then I've never used (or seen anyone use) the
global namespace.

How would you create a namespaced proxy?


Create an assembly for each OEM assembly you want to wrap. In the namespace
of your choice (not global) create a class or classes that essentially
forward on the calls and data to the OEM assembly. Each of your proxy
assemblies will include only the OEM assembly that it is wrapping, hence no
conflict. Then, your app code uses your proxies and doesn't reference the
OEM assemblies directly. Problem solved.

But like I said, I've never had to give a second's thought to resolving
naming conflicts before today since I've never come across one, so there
might be a trivial solution out there.

--
Regards,

Tim Haughton

Agitek
http://agitek.co.uk
http://blogitek.com/timhaughton
Nov 17 '05 #4
"anders" <an****@discuss ions.microsoft. com> schrieb im Newsbeitrag
news:1E******** *************** ***********@mic rosoft.com...
I already asked this question in the VB.NET group but as C# seems to have
the
same problem, I'll try here, too.

I have 2 external OEM assemblies A1 and A2 that both define class X (same
name, not same class) in the global namespace. I need to use both X'es in
my
project. How do I fully qualify the X'es to avoid the name clash between X
from A1 and X from A2.

The using statement provides a way of aliasing clashing names from named
namespaces but it does NOT give the possibility to resolve name clashes in
the global namespace. Or is it possible?

Any bright minds out there who have a solution?

Otherwise, this seems to be a serious problem with .NET languages. I hope
somebody from Microsoft sees this and gets this problem fixed.

Yes, anybody from Microsoft saw it, and it will be fixed in VS2005/C#2.0 ;-)

Christof
Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

88
5083
by: Tim Tyler | last post by:
PHP puts most of its functions into a big flat global namespace. That leads to short function names - but creates a namespace minefield for programmers. Lots of the functions are legacies from the days before PHP got object-oriented features. For instance we currently have:
12
1982
by: Santiago de Compostela | last post by:
Hi The following program doesn't compile on MS VC++ or Bloodshed Dev-C++ #include <iostream> int strlen(const char *in) {
4
7102
by: Dan Elliott | last post by:
Hello, Converting from a working C program to C++, I run into the following error: I have a header: (header.h) namespace shared{ ... struct X{ ...
2
7501
by: Tony Johansson | last post by:
Hello! I'm reading a book about C++ and there is something that I don't understand so I ask you. Below I have the text from the book and the code from the file where main is located and some namespace definition with class definitions. The book says "C++ has a global anonymous namespace that is similar to Java's global anonymous...
3
1477
by: seberino | last post by:
At top of a module I have an integer like so... foo = 4 In a function in that module I know I need to do 'global foo' to get at the value 4. .... IIRC, for dictionaries you DO NOT have this issue?
5
3572
by: george r smith | last post by:
In the MSDN documentation there is a reference to "the global scope". For example "You can declare types directly in the global scope." I have search extensively and can not find a definition of the "global scope" but could it be the space above the namespace reserved word, such as: public class Bank { ... } namespace Banking
18
2932
by: robert | last post by:
Using global variables in Python often raises chaos. Other languages use a clear prefix for globals. * you forget to declare a global * or you declare a global too much or in conflict * you have a local identical variable name and want to save/load it to/from the global with same name * while you add code, the definition of globals moves...
3
2613
by: mrstephengross | last post by:
Hi folks. I've got a weird situation--gcc doesn't like the folllowing code snippet, but I don't know if it's correct or not. Here's the situation: In the global namespace, I've got a operator<< declared that will send a vector<Tto a std::ostream. In the "outer" namespace, I've got a operator<< declared that will send a Thing<Tto a...
1
29323
weaknessforcats
by: weaknessforcats | last post by:
C++: The Case Against Global Variables Summary This article explores the negative ramifications of using global variables. The use of global variables is such a problem that C++ architects have called it polluting the global namespace. This article explores what happens when the global namespace becomes polluted and how to avoid this...
3
1870
by: taps128 | last post by:
I've been reading the namespace specification for the 5.3 relaese, and I can't stop thinking that they have complicated the thing unecessary. Here is what I mean. So far if you call a function or a class in (which is not global ) using this: ::A::foo(); it will first try to run the function foo() from the namespace A , and
0
7700
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7614
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7676
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7974
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.