I have 2 external assemblies A1 and A2 that both define class X in the global
namespace. I need to use both assemblies in my VB project but the names X are
ambiguous. How can I get around this problem?
Is there a way to refer to the assembly, f.ex. A1.X and A2.X (this syntax
does not compile).
Or can I change the name X in the Imports directive? Again the problem is
how do I refer to the 2 different X'es in assemblies A1 and A2:
Imports A1_X = A1.X ' Does not compile
BTW, is there any way to explicitly refer to the global namespace, like C++
::?
Any bright ideas out there? 10 6645
"anders" <an****@discuss ions.microsoft. com> schrieb I have 2 external assemblies A1 and A2 that both define class X in the global namespace. I need to use both assemblies in my VB project but the names X are ambiguous. How can I get around this problem?
Is there a way to refer to the assembly, f.ex. A1.X and A2.X (this syntax does not compile).
Or can I change the name X in the Imports directive? Again the problem is how do I refer to the 2 different X'es in assemblies A1 and A2:
Imports A1_X = A1.X ' Does not compile
BTW, is there any way to explicitly refer to the global namespace, like C++ ::?
Any bright ideas out there?
Did you leave the "root namespace" of the two assemblies empty? If you
didn't, you can use the full qualified name.
Armin
Armin, how do you set the root namespace? I get very confused regarding the
namespace heirchy
--
Dennis in Houston
"Armin Zingler" wrote: "anders" <an****@discuss ions.microsoft. com> schrieb I have 2 external assemblies A1 and A2 that both define class X in the global namespace. I need to use both assemblies in my VB project but the names X are ambiguous. How can I get around this problem?
Is there a way to refer to the assembly, f.ex. A1.X and A2.X (this syntax does not compile).
Or can I change the name X in the Imports directive? Again the problem is how do I refer to the 2 different X'es in assemblies A1 and A2:
Imports A1_X = A1.X ' Does not compile
BTW, is there any way to explicitly refer to the global namespace, like C++ ::?
Any bright ideas out there?
Did you leave the "root namespace" of the two assemblies empty? If you didn't, you can use the full qualified name.
Armin
Can you elaborate, please. You have lost me!
"Armin Zingler" wrote: "anders" <an****@discuss ions.microsoft. com> schrieb I have 2 external assemblies A1 and A2 that both define class X in the global namespace. I need to use both assemblies in my VB project but the names X are ambiguous. How can I get around this problem?
Is there a way to refer to the assembly, f.ex. A1.X and A2.X (this syntax does not compile).
Or can I change the name X in the Imports directive? Again the problem is how do I refer to the 2 different X'es in assemblies A1 and A2:
Imports A1_X = A1.X ' Does not compile
BTW, is there any way to explicitly refer to the global namespace, like C++ ::?
Any bright ideas out there?
Did you leave the "root namespace" of the two assemblies empty? If you didn't, you can use the full qualified name.
Armin
"anders" <an****@discuss ions.microsoft. com> schrieb "anders" <an****@discuss ions.microsoft. com> schrieb I have 2 external assemblies A1 and A2 that both define class X in the global namespace. I need to use both assemblies in my VB project but the names X are ambiguous. How can I get around this problem?
Is there a way to refer to the assembly, f.ex. A1.X and A2.X (this syntax does not compile).
Or can I change the name X in the Imports directive? Again the problem is how do I refer to the 2 different X'es in assemblies A1 and A2:
Imports A1_X = A1.X ' Does not compile
BTW, is there any way to explicitly refer to the global namespace, like C++ ::?
Any bright ideas out there?
Did you leave the "root namespace" of the two assemblies empty? If you didn't, you can use the full qualified name.
Can you elaborate, please. You have lost me!
In each assembly, you can set the "root namespace" in the project
properties. That's the namespace all classes and namespaces are placed in.
If you left them (in both projects) empty, you probably really have got a
problem because the full qualified name is the same. If you didn't leave it
empty, you could use the full qualified name to specify the class. If A1 ist
the root namespace of assembly A1, then A1.X is the full qualified class
name of the class in assembly A1.
Armni
"anders" <an****@discuss ions.microsoft. com> wrote in message
news:E4******** *************** ***********@mic rosoft.com... I have 2 external assemblies A1 and A2 that both define class X in the global namespace. I need to use both assemblies in my VB project but the names X are ambiguous. How can I get around this problem?
Either fully-qualify all references to each class, as in
sData = NS1.NS2.NS3.X.S tringMethod()
sData = NS4.NS5.NS6.X.S tringMethod()
or change the Imports statements so add your own "alias", as in
Imports A1=NS1.NS2.NS3
Imports A2=NS4.NS5.NS6
sData = A1.X.StringMeth od()
sData = A2.X.StringMeth od()
(I use the same thing with the VisualBasic namespace, just to jog my
memory about the potential differences, as in
sItems = VB.Split( "string with line breaks", vbCrLf )
HTH,
Phill W.
I found that if I don't specifically provide a root namespace, then when I
create a new project, the name of the directory if used.
--
Dennis in Houston
"Phill. W" wrote: "anders" <an****@discuss ions.microsoft. com> wrote in message news:E4******** *************** ***********@mic rosoft.com... I have 2 external assemblies A1 and A2 that both define class X in the global namespace. I need to use both assemblies in my VB project but the names X are ambiguous. How can I get around this problem?
Either fully-qualify all references to each class, as in
sData = NS1.NS2.NS3.X.S tringMethod() sData = NS4.NS5.NS6.X.S tringMethod()
or change the Imports statements so add your own "alias", as in
Imports A1=NS1.NS2.NS3 Imports A2=NS4.NS5.NS6
sData = A1.X.StringMeth od() sData = A2.X.StringMeth od()
(I use the same thing with the VisualBasic namespace, just to jog my memory about the potential differences, as in
sItems = VB.Split( "string with line breaks", vbCrLf )
HTH, Phill W.
A1 and A2 are OEM products so I don't have the source code or project files
to fiddle with. This begins to look like a serious problem in .NET languages.
The VB.NET Imports directive gives you the possibility to resolve name
clashes between named namespaces but NOT clashes within the global namespace!
I also looked into C# and Managed C++ and could not find any solution to
this problem.
"Armin Zingler" wrote: "anders" <an****@discuss ions.microsoft. com> schrieb "anders" <an****@discuss ions.microsoft. com> schrieb > I have 2 external assemblies A1 and A2 that both define class X > in the global namespace. I need to use both assemblies in my VB > project but the names X are ambiguous. How can I get around this > problem? > > Is there a way to refer to the assembly, f.ex. A1.X and A2.X > (this syntax does not compile). > > Or can I change the name X in the Imports directive? Again the > problem is how do I refer to the 2 different X'es in assemblies > A1 and A2: > > Imports A1_X = A1.X ' Does not compile > > BTW, is there any way to explicitly refer to the global > namespace, like C++ ::? > > Any bright ideas out there?
Did you leave the "root namespace" of the two assemblies empty? If you didn't, you can use the full qualified name.
Can you elaborate, please. You have lost me!
In each assembly, you can set the "root namespace" in the project properties. That's the namespace all classes and namespaces are placed in. If you left them (in both projects) empty, you probably really have got a problem because the full qualified name is the same. If you didn't leave it empty, you could use the full qualified name to specify the class. If A1 ist the root namespace of assembly A1, then A1.X is the full qualified class name of the class in assembly A1.
Armni
You don't seem to answer my question. How do you fully qualify X which is in
the global namespace of both assemblies A1 and A2?
"Phill. W" wrote: "anders" <an****@discuss ions.microsoft. com> wrote in message news:E4******** *************** ***********@mic rosoft.com... I have 2 external assemblies A1 and A2 that both define class X in the global namespace. I need to use both assemblies in my VB project but the names X are ambiguous. How can I get around this problem?
Either fully-qualify all references to each class, as in
sData = NS1.NS2.NS3.X.S tringMethod() sData = NS4.NS5.NS6.X.S tringMethod()
or change the Imports statements so add your own "alias", as in
Imports A1=NS1.NS2.NS3 Imports A2=NS4.NS5.NS6
sData = A1.X.StringMeth od() sData = A2.X.StringMeth od()
(I use the same thing with the VisualBasic namespace, just to jog my memory about the potential differences, as in
sItems = VB.Split( "string with line breaks", vbCrLf )
HTH, Phill W.
"anders" <an****@discuss ions.microsoft. com> schrieb In each assembly, you can set the "root namespace" in the project properties. That's the namespace all classes and namespaces are placed in. If you left them (in both projects) empty, you probably really have got a problem because the full qualified name is the same. If you didn't leave it empty, you could use the full qualified name to specify the class. If A1 ist the root namespace of assembly A1, then A1.X is the full qualified class name of the class in assembly A1.
A1 and A2 are OEM products so I don't have the source code or project files to fiddle with. This begins to look lik easeriousproble min.NETlanguage s. The VB.NET Imports directive gives you the possibility to resolve name clashes between named namespaces but NOT clashes within the global namespace!
I also looked into C# and Managed C++ and could not find any solution to this problem.
I do not really see the problem. I do not even have the possibilty to set
references to two assemblies containing conflicting class names because I
get this error:
"bla\ClassLibra ry2\Class1.vb(1 ): class "Class1" and class "Class1", defined
in "bla\ClassLibra ry1\Class1.vb", conflict in namespace "<Default>" "
You get this message if you create a new project, add two new
classlibraries, delete the root namespace in both libraries and try to set a
reference from the main project to both classlibraries.
Are you sure that the classes are not contained in a namespace in both
assemblies? Have a look @ the object browser.
Armin This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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:
|
by: Wat |
last post by:
If a class is not given a namespace, what does this imply?
From inside of the class, if to call global functions, should global scope
:: be used at all?
If global scope :: used, what benefits does it bring?
Thanks in advance!
|
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 package. All declarations not explicitly placed in named
|
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?
|
by: anders |
last post by:
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...
| |
by: tafs7 |
last post by:
My code below is supposed to email me when an error occurs on the
application, but it's not emailing anything. Am I missing something?
I know the smtp servers I've tried work. I even added a App_Start
handler to see if I could get emailed at all even from the first
request of the app, but to no avail. Could someone please help me
out? Thanks a lot!
--Thiago
Web developer
AgniTEK
|
by: Thomas Coleman |
last post by:
Ok, I've obviously discovered that Global.aspx has been completely changed in
..NET 2.0. However, I haven't figured out how to declare a constant that's
available to any page in my application without having to jump through a bunch
of hoops.
First, let me layout how it worked in 1.1. In the Global.asax, within the Global
class construct, I would simply add something like:
public const string FOO = "foo";
|
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 std::ostream.
In the "outer" namespace, I've got a function "foo" that tries to send
a vector<Tto a...
|
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 condition.
The opinions expressed in this article are those of the author alone although many have...
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |