C#语法 [英] C# syntax

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

问题描述

你好。


为什么需要使用new C#中的关键字是为了构造对象吗?

构造函数调用的语义是否具有其他含义除了对象

构造在堆中(或堆栈中的值类型)? br $>
-

Vladimir Nesterovsky

访问: http://constcli.sscli.net

电子邮件: ne ********* @ sscli.net vl ***** *@nesterovsky-bros.com

home: http ://www.nesterovsky-bros.com

解决方案

Vladimir Nesterovsky< vl ****** @ nesterovsky-bros .COM>写道:

为什么需要使用new C#中的关键字是为了构造对象?


它有助于区分方法和构造函数

显而易见。

构造函数调用的语义是否具有其他含义除了对象
堆中的构造(或堆栈中的值类型)?




不是我知道的 - 你是什么样的东西思考?


-

Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet

如果回复小组,请不要给我发邮件


> >为什么需要使用新 C#中的关键字是为了构造

对象?


它有助于使方法和构造函数之间的区别明显。
< blockquote class =post_quotes>构造函数调用的语义是否具有除堆中的对象构造(或堆栈中的值类型)之外的其他含义?



不是很远我知道 - 你在考虑什么样的事情?




我刚注意到一些代码非常重载了这个关键字。 :-)在

C#中,我认为它没有任何有用的语义含义。


-

Vladimir Nesterovsky
访问: http://constcli.sscli.net

电子邮件: ne*********@sscli.net vl******@nesterovsky-bros.com

home:< a rel =nofollowhref =http://www.nesterovsky-bros.comtarget =_ blank> http://www.nesterovsky-bros.com


Vladimir Nesterovsky< vl ****** @ nesterovsky-bros.com>写道:

不是我知道的 - 你在想什么样的东西?
我刚注意到一些代码非常重载使用此关键字。 : - )




你是什么意思重载在这里?

在C#中,我认为它没有任何有用的语义含义。




它的用途是在可读性方面,我用于一个我很高兴它就在那里。


-

Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet

如果回复该组,请不要给我发邮件


Hello there.

Why does one need to use "new" keyword in C# in order to construct object?
Does semantic of constructor invoke have other meaning except of object
construction in the heap (or value type in a stack)?
--
Vladimir Nesterovsky
visit: http://constcli.sscli.net
e-mail: ne*********@sscli.net, vl******@nesterovsky-bros.com
home: http://www.nesterovsky-bros.com

解决方案

Vladimir Nesterovsky <vl******@nesterovsky-bros.com> wrote:

Why does one need to use "new" keyword in C# in order to construct object?
It helps to make the difference between methods and constructors
obvious.
Does semantic of constructor invoke have other meaning except of object
construction in the heap (or value type in a stack)?



Not as far as I''m aware - what kind of thing were you thinking of?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


> > Why does one need to use "new" keyword in C# in order to construct
object?


It helps to make the difference between methods and constructors
obvious.

Does semantic of constructor invoke have other meaning except of object
construction in the heap (or value type in a stack)?



Not as far as I''m aware - what kind of thing were you thinking of?



I just noticed some code that is very overloaded with this keyword. :-) In
C# it has no useful semantic meaning in my opinion.

--
Vladimir Nesterovsky
visit: http://constcli.sscli.net
e-mail: ne*********@sscli.net, vl******@nesterovsky-bros.com
home: http://www.nesterovsky-bros.com


Vladimir Nesterovsky <vl******@nesterovsky-bros.com> wrote:

Not as far as I''m aware - what kind of thing were you thinking of?
I just noticed some code that is very overloaded with this keyword. :-)



What do you mean by "overloaded" here?
In C# it has no useful semantic meaning in my opinion.



Its use is in terms of readability, and I for one am glad it''s there.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


这篇关于C#语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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