系统名称空间(s)问题 [英] System namespace(s) problem

查看:69
本文介绍了系统名称空间(s)问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎遇到了System命名空间的问题。

在.NET 2005中通过对象浏览器查看时,似乎有两个系统名称空间



一个全球系统::

然后一个< mscorlib>

每个都不同,有不同的类集和一些共同点。

为什么会这样?


我的项目需要引用< mscorlib>中的项目。而不是

其他。

我如何更正?

解决方案

< blockquote>好的,我现在明白了命名空间是在system.dll和/ b
mscorlib.dll等之间共享的。

例如


系统: :Collections ::


在共享命名空间的地方,每个都有一组独特的类(我假设为b $ b假设)为什么它会像这样拆分? br />

我的问题我的项目似乎没有完全访问每个

类每个

例如我无法参考


System :: Diagnostics :: Debug :: Assert(mKeys.Count == mValues.Count);


错误C3083:' 'Debug'':''::''左边的符号必须是一个类型


这是在mscorlib.dll中定义的


但是引用了List< T>


也在mscorlib.dll中定义


这里怎么回事?


Herby写道:

好了,我现在明白了命名空间是在system.dll和
mscorlib.dll等之间共享的
例如

系统::收藏::

共享命名空间的地方每个都有一组独特的类(我假设)为什么会这样拆分?

我的问题我的项目似乎没有完全访问每个类中的所有

例如我无法引用

System :: Diagnostics :: Debug :: Assert(mKeys) .Count == mValues.Count);




System.Diagnostics在System.dll中,而不是mscorlib.dll。


每个类的主要帮助主题列出了类定义为

的程序集,因此无需猜测或搜索。


- cd


List< T>定义了什么?


如果我想使用mscorlib.dll中的类,那么我希望我能做什么

执行以下操作:

#import< mscorlib.dll>


这也是为System.dll秘密完成的吗?


我还有另外一个问题:


CString mfc_str(" Hello .NET");


//由于另一个没有名称空间的lib,我必须对此进行限定/>
a字符串类


系统::字符串^ man_str = gcnew系统::字符串(mfc_str);


我得到以下错误:


错误C2440:''初始化'':无法从''CString''转换为

''wchar_t''

没有可用的用户定义转换运算符可以执行此转换
,或者无法调用运算符


如果我通过MFC字符串到另一个模块作为参数和里面做

相同的转换然后它的罚款!

在anoth用MFC进行虚拟项目这个转换没有

参数传递。


有什么问题?


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?

解决方案

Ok i understand now that namespaces are shared across system.dll and
mscorlib.dll etc
E.g.

System::Collections::

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::Diagnostics::Debug::Assert( 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?


Herby wrote:

Ok i understand now that namespaces are shared across system.dll and
mscorlib.dll etc
E.g.

System::Collections::

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::Diagnostics::Debug::Assert( mKeys.Count == mValues.Count );



System.Diagnostics 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


Where is List<T> defined?

What if i want to use classes from mscorlib.dll am i then expected to
do the following:
#import<mscorlib.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?


这篇关于系统名称空间(s)问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆