Re: Boxing and Unboxing ??



Peter Olcott wrote:
What I am looking for is all of the extra steps that form what is referred to as boxing and unboxing. In C/C++ converting a value type to a reference type is a very simple operation and I don't think that there are any runtime steps at all. All the steps are done at compile time. Likewise for converting a reference type to a value type.

in C/C++
int X = 56;
int *Y = &X;
Now both X and *Y hold 56, and Y is a reference to X;

That code is not equivalent to what we are discussing in C#.

In fact it does not really have any equivalent in C# (not using
unsafe code).

Arne
.



Relevant Pages

  • Re: Boxing and Unboxing ??
    ... So with Generics Boxing and UnBoxing beomes obsolete? ... In C/C converting a value type to ... reference type to a value type. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Boxing and Unboxing ??
    ... They get rid of boxing and unboxing penalties. ... In C/C converting a value type to ... reference type to a value type. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Boxing and Unboxing ??
    ... In C/C++ converting a value type to a reference type is a ... Likewise for converting a reference type ... According to Troelsen in "C# and the .NET Platform" ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Boxing and Unboxing ??
    ... Likewise for converting a reference type ... According to Troelsen in "C# and the .NET Platform" ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Boxing and Unboxing ??
    ... In C/C++ converting a value type to a reference type is a very simple operation and I don't think that there are any runtime steps at all. ... All the steps are done at compile time. ...
    (microsoft.public.dotnet.languages.csharp)