473,672 Members | 2,953 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System namespace(s) problem

I seem to be having a problem with System namespace.
There seem to two System namepaces when viewing through Object browser
within .NET 2005.
One global System::
Then one under <mscorlib>

Each is different, having different sets of classes and some in common.
Why is this?

My project needs to reference the ones from <mscorlib> and not the
other.
How do i correct this?

Dec 13 '05 #1
10 3049
Ok i understand now that namespaces are shared across system.dll and
mscorlib.dll etc
E.g.

System::Collect ions::

Where a namespace is shared each will have a unique set of classes(I
assume) why has it been split like this?

My problem my project does not seem to have full access to all the
classes in each
For example I am unable to reference

System::Diagnos tics::Debug::As sert( mKeys.Count == mValues.Count );

error C3083: 'Debug': the symbol to the left of a '::' must be a type

This is defined in mscorlib.dll

But am referencing List<T>

also defined in mscorlib.dll

Whats going on here?

Dec 13 '05 #2
Herby wrote:
Ok i understand now that namespaces are shared across system.dll and
mscorlib.dll etc
E.g.

System::Collect ions::

Where a namespace is shared each will have a unique set of classes(I
assume) why has it been split like this?

My problem my project does not seem to have full access to all the
classes in each
For example I am unable to reference

System::Diagnos tics::Debug::As sert( mKeys.Count == mValues.Count );


System.Diagnost ics is in System.dll, not mscorlib.dll.

The main help topic for each class lists the assembly where the class is
defined, so there's no need to guess or hunt.

-cd
Dec 13 '05 #3
Where is List<T> defined?

What if i want to use classes from mscorlib.dll am i then expected to
do the following:
#import<mscorli b.dll>

Is this being secrectly done for System.dll too?

Im also having another problem:

CString mfc_str("Hello .NET");

// I have to qualify this due to another lib without a namespace having
a String class

System::String^ man_str = gcnew System::String( mfc_str);

I get the following error:

error C2440: 'initializing' : cannot convert from 'CString' to
'wchar_t'
No user-defined-conversion operator available that can perform this
conversion, or the operator cannot be called

If i pass the MFC string to another module as a parameter and inside do
the same conversion then its fine!
In another dummy project with MFC this conversion is fine without
parameter passing.

What is the problem?

Dec 13 '05 #4
Herby wrote:
Where is List<T> defined?
RTFM, man...

What if i want to use classes from mscorlib.dll am i then expected to
do the following:
#import<mscorli b.dll>
No you don't. You want to

#using <mscorlib.dll >

Is this being secrectly done for System.dll too?
No, you need to

#using <system.dll>
Im also having another problem:


I can't help you with MFC problems. Hopefully someone else will respond to
that part.

-cd

Dec 13 '05 #5
Something is wrong
Why would i get the following error

error C3225: generic type argument for 'TKey' cannot be 'System::Char
^', it must be a value type or a handle to a reference type

When i have the following declaration:

Dictionary<Syst em::String^, RuntimeMap^> mMap;

Dec 13 '05 #6
"Herby" <pr********@gma il.com> wrote
Something is wrong
Why would i get the following error

error C3225: generic type argument for 'TKey' cannot be 'System::Char
^', it must be a value type or a handle to a reference type
Char^ is not a value type, but a boxed value type. System::Char is
the name of the value type (or only char)
When i have the following declaration:

Dictionary<Syst em::String^, RuntimeMap^> mMap;

The error message doesn't make sense for that declaration.
Are you sure you've quoted the correct line of code?

-hg
Dec 13 '05 #7
"Holger Grund" <ho**********@r emove.ix-n.net> wrote
Char^ is not a value type, but a boxed value type. System::Char is
the name of the value type (or only char)

Actually, that should be wchar_t not char.

-hg
Dec 13 '05 #8
"Herby" <pr********@gma il.com> wrote
Im also having another problem:

CString mfc_str("Hello .NET");

// I have to qualify this due to another lib without a namespace having
a String class

System::String^ man_str = gcnew System::String( mfc_str); AFAICT, that should work just fine.

As I understand, this should call the String::String( signed char* ) ctor
(assuming you're not compiling with /D_UNICODE, in which case
the wchar_t* overload would be selected).
CString has a conversion to const char* which should be OK for
the conversion.

I get the following error:

error C2440: 'initializing' : cannot convert from 'CString' to
'wchar_t'
No user-defined-conversion operator available that can perform this
conversion, or the operator cannot be called

That doesn't make sense. It sounds like you're using a ctor overload
with more than one parameter. In that case the first argument type is
a wchar_t for all overloads.

Are you sure, that this is the exact source line and the full diagnostic
message?

-hg
Dec 13 '05 #9
Thanks Holger.

I can assure you i am showing you the right lines of code.
I know it does not make sense, something else is causing these
problems, my hunch is its something to do with the include files.
If i compile the class containing these data members then compiles
fine.
If i compile a client of this class then thats when i get the errors.
Before i went into a painstaking lenghty investigation, i just wondered
if anyone had a 'quick' get out.

I can get around this for the moment via using the following:

ArrayList mKeys;
List<RuntimeMap ^> mValues;

Rather than using the much more expressive:

Dictionary<Stri ng^, RuntimeMap^> mMap;

Dec 14 '05 #10

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

Similar topics

1
4428
by: DelboyJay | last post by:
I have found a strange resource problem, but luckily I have also found the solution which was not obvious from the runtime exception. I really think that the compiler should pick up this problem and fix it. What do you people think? Try the following: 1. Create a new c# windows application called MyTestApp 2. Create a notifyIcon on the form 3. Attach any icon you wish to the notifyIcon 4. Build and run the program to confirm that it...
2
3498
by: JohnnySparkles | last post by:
Hi everyone, I'm currently writing an application which uses the XmlSerializer class to serialize/deserialize objects to/from xml. Now when deserializing an XmlDocument back into the object, I'm using the System::Type::GetType(String* typeName) to create a Type* needed to construct the XmlSerializer. The typeName argument is taken from the XmlDocument and consists of the
8
7835
by: Richard Lionheart | last post by:
Hi All, I tried using RegEx, but the compiler barfed with "The type of namespace 'RegEx' could not be found. Prior to this, I had the same problem with MatchCollection, but discovered it's in the namespace "System.Text.RegularExpressions;" and that namespace is, in turn, defined in the namespace "System", according to MSDN at http://msdn2.microsoft.com/en-us/library/c75he57e(en-us,VS.80).aspx. So adding "using...
5
2232
by: martin | last post by:
Hi, I have created a class that is totally seperate from my web application. However this class is used extensivly by the web application for stuff like data access. I wish to add a function to this class that will send email, however my class will not seem to recognise the system.web.mail.mailmessage. my first impression on this is that I may have to use some sort of third
1
18171
by: Marc | last post by:
Hi! I'm working with a C# client that calls a php web service. I've created a wrapper to call the service using .NET wsdl tool (adding a web reference). The call to the server works fine, it is serialized correctly, and the server returns a response (I've captured the response and it's correct!) but when the .NET deserialize this response, it throws the exception "System.InvalidOperationException: There is an error in XML
7
6725
by: eric | last post by:
I'm writing a program in C# and found a couple of threads about how to check the status of a printer before sending it any data, to ensure that the printer is ready to print. They say to include the System.Management namespace. This is where my problem is, I have no System.Management namespace. Could anyone help me locate it or a reference to locate it?
0
4347
by: Jim Duffie | last post by:
Hi, I am trying to build a simple websire using the above in Visual Web Developer. When finished I have build the website and it works fine locally but when I FTP it to the server I am getting a parse error. Should I be uploading a DLL as well (I can't see one in directory)? The error is :- Parser Error Message: Could not load type System.Web.UI.WebControls.Menu from assembly System.Web, Version=1.0.5000.0, Culture=neutral,...
2
20828
by: AnalogKid17 | last post by:
Keywords: ASP.NET app with VS2005 running on Win2003 with IIS6, and SQL2000 on a WinXP Box I've betting the following for days... it's driving me insane: Server Error in '/' Application. Security Exception Description: The application attempted to perform an operation not
9
2182
by: Arpan | last post by:
If I am not wrong, System.IO is one of the seven namespaces that get imported in all ASP.NET page automatically but in the following code: <%@ Import Namespace="System.IO" %> <script runat="server"> Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs) Dim ioFileInfo As New FileInfo("C:\Inetpub\wwwroot\File1.asp") lblOutput.Text = "Name: " & ioFileInfo.Name & "<br>" lblOutput.Text += "Path: " & ioFileInfo.DirectoryName & "<br>"
6
4080
by: Mark Rae | last post by:
Hi, I'm in the process of updating an ASP.NET v1.1 web app to v2. The app uses ActiveDirectory a great deal, and I'm trying to use the new System.Collections.Generic namespace where possible, having been advised by several luminaries that that is a "good thing to do"... :-) However, I'm experiencing a problem with the IEnumerable interface. (N.B. I understand fully that I should be using the LDAP provider instead of the WinNT provider...
0
8498
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8840
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8694
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7457
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6249
isladogs
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...
0
5718
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();...
0
4237
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...
1
2830
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
2
1831
bsmnconsultancy
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...

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.