int是值类型还是引用类型? [英] whether int is a value type or reference type?
本文介绍了int是值类型还是引用类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好...
int是值类型还是引用类型?
:confused:
显然,它是值类型,但是...如果我们遵循
第1行int a = 10;
第2行a.tostring()
第2行显示a调用其基类(即object)的方法.这意味着int是一个类,然后我们如何将其称为值类型... ???
在此先感谢
如果有on调用帮助,请...
hi all...
whether int is a value type or reference type?
:confused:
obviously it is value type but...if we does following
line 1 int a =10;
line 2 a.tostring()
line 2 shows that a calls the mathod of its base class (which is object).it means int is a class then how do we call it a value type...???
thanks in advance
if some ons call help please...
推荐答案
这意味着在您调用ToString时,会将int装箱(变成一个对象).
It means that the int is boxed ( turned into an object ) when you call ToString on it.
^ ]可能会让您了解google的工作方式,这一定会在将来对您有所帮助. 《 C#内部书籍》是购买的很好参考书,但大多数C#书籍也会对此进行详细介绍.
This[^] might give you some idea how google works, which is bound to help you in future. The book Inside C# is a good reference to buy, but most C# books will also cover this in detail.
亲爱的格劳斯.有更好的图片...
Dear Grauss..can u give me some elaboration or some link so that i can have a better picture...
这篇关于int是值类型还是引用类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文