Talk:Comparison of C Sharp and Java: Difference between revisions

Content deleted Content added
Dahvyd (talk | contribs)
Dahvyd (talk | contribs)
Line 48:
var list = new List<int>();
list.Add(2);
int value = list[0];
</pre>
And it would ''not'' involve the relatively expensive boxing and unboxing conversions. This goes for any primitive and value type (primitive types are just a subset of value types). <code>int</code> is a value type, and in C# you can define new value types. Only when value types are treated ''like objects'' (reference types) are they boxed. You may declare arrays of custom value types and the array will contain the actual values not a boxed references to values. [[User:Useerup|Useerup]] ([[User talk:Useerup|talk]]) 23:23, 26 June 2011 (UTC)