Content deleted Content added
Hervegirod (talk | contribs) |
Sander Säde (talk | contribs) →Value types: cmt |
||
Line 52:
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)
:::: Microsoft documentation says: "Boxing operations occur when you pass a value type to a method that takes a System.Object as an input parameter."[http://msdn.microsoft.com/en-us/library/ms173104.aspx]. Which is the case for List.[http://msdn.microsoft.com/en-us/library/3wcytfd1.aspx]. There is a lot of syntactic sugar in C#. [[User:Hervegirod|Hervegirod]] ([[User talk:Hervegirod|talk]]) 12:39, 15 January 2012 (UTC)
:::::This thread is more than six months old, so I wouldn't expect much response. However, the documentation you linked says "..takes a ''System.Object'' as..". Generic list does not take System.Object as input parameter, indeed, the lack of boxing is one the main reasons for generics to exist and why generic collections are faster than their nongeneric counterparts. List<T> differs from ArrayList (which inherits from IList interface) by strong typing of the collection objects. --[[User:Sander_S%C3%A4de|<span style="font-family:Courier; color:#555">Sander Säde</span>]] 12:59, 15 January 2012 (UTC)
== I think you're missing the point... ==
|