Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created March 1, 2014 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fhernd/9297669 to your computer and use it in GitHub Desktop.
Save Fhernd/9297669 to your computer and use it in GitHub Desktop.
Demostración de la operación Boxing en C#.
public class BoxingPrueba
{
public static void Main()
{
int i = 123;
// La operación copia el valor de i dentro del objeto object
object o = i;
// Asignamos otro valor a la variable entera i
i = 456;
// Presentamos los valores en pantall
// Observaremos que las variables i y o almacenan valores diferentes.
Console.WriteLine ("El valor del tipo por valor es: {0}.", i);
Console.WriteLine ("El valor del tipo por referencia es: {0}.", o);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment