object vs System.Object [英] object vs System.Object

查看:67
本文介绍了object vs System.Object的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有些人认为你不应该使用C#关键字object。而不是

真正的类型System.Object。


选择一个而不是另一个的一般经验法则是什么?


先谢谢。

-

Gaemic!

Some argues that you should not use the C# keyword "object" instead of the
real type System.Object.

What would be the general rule of thumb for choosing one over the other?

Thanks in advanced.
--
Gaemic!

推荐答案




我认为关键字对象只是System.Object的直接别名,所以我认为如果你使用object或System.Object,它就是一样的。


-

问候,

Peter Jausovec

http://blog.jausovec.net

Gaemic <嘎**** @ discussions.microsoft.com> je napisalvsporoèilo

新闻:AA ********************************** @ microsof t.com ...
Hi,

I think that keyword "object" is just an direct alias for System.Object so I
think it''s the same if you use object or System.Object.

--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
"Gaemic" <Ga****@discussions.microsoft.com> je napisal v sporoèilo
news:AA**********************************@microsof t.com ...
有些人认为你不应该使用C#关键字object。而不是真正的类型System.Object。

选择一个而不是另一个的一般经验法则是什么?

感谢先进。
-
Gaemic!
Some argues that you should not use the C# keyword "object" instead of the
real type System.Object.

What would be the general rule of thumb for choosing one over the other?

Thanks in advanced.
--
Gaemic!



Gaemic,


没有经验法则,这纯粹是个人偏好。两者是完全相同的
。 "对象"是C#编译器识别为

" System.Object"的别名。 " System.Object的"不是真实类型。与对象相比,

它们都是相同类型的词汇表示。


你挑选什么并不重要(哪一个我认为暗示

应该没有关于它的争论,但是人们很傻。)


希望这会有所帮助。


-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com


" Gaemic" <嘎**** @ discussions.microsoft.com>在留言中写道

新闻:AA ********************************** @ microsof t.com ...
Gaemic,

There is no rule of thumb, it''s purely personal preference. The two are
exactly the same. "object" is an alias that the C# compiler recognizes for
"System.Object". "System.Object" is not a "real type" compared to "object",
they both are lexical representations of the same type.

It truly doesn''t matter what you pick (which one would think implies
that there should be no argument about it, but people are silly like that).

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Gaemic" <Ga****@discussions.microsoft.com> wrote in message
news:AA**********************************@microsof t.com...
有些人认为你不应该使用C#关键字object。而不是真正的类型System.Object。

选择一个而不是另一个的一般经验法则是什么?

感谢先进。
-
Gaemic!
Some argues that you should not use the C# keyword "object" instead of the
real type System.Object.

What would be the general rule of thumb for choosing one over the other?

Thanks in advanced.
--
Gaemic!



2004年12月8日星期三07:37:01 -0800,Gaemic写道:
On Wed, 8 Dec 2004 07:37:01 -0800, Gaemic wrote:
有些人认为你不应该使用C#关键字object。而不是
真正的类型System.Object。

选择一个而不是另一个的一般经验法则是什么?

先谢谢。
Some argues that you should not use the C# keyword "object" instead of the
real type System.Object.

What would be the general rule of thumb for choosing one over the other?

Thanks in advanced.




C#关键字对象和System.Object是相同的,第一个只是后者的

别名。我认为没有理由使用System.Object

而不是object。那些反对使用对象的人也反对使用int(System.Int32),字符串(System.String),字节

(System.Byte)使用
),bool(System.Boolean)等?

-

Tom Porterfield



C# keyword object and System.Object are the same, the first is just an
alias for the latter. I can think of no reason to use System.Object
instead of object. Do those who argue against the use of object also argue
against the use of int (System.Int32), string (System.String), byte
(System.Byte), bool (System.Boolean), etc.?
--
Tom Porterfield


这篇关于object vs System.Object的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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