Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. class Pruebaref
  2. {
  3.     static void PruebaModificadorRef(ref int p)
  4.     {
  5.         p = p + 1;              // Incrementa p en una unidad
  6.         Console.WriteLine(p);   // Escribe valor de p en pantalla
  7.     }
  8.  
  9.     static void Main()
  10.     {
  11.         int x = 8;
  12.         PruebaModificadorRef(ref x);        // Usa el valor de x sin copiarlo
  13.         Console.WriteLine(x);               // x vale 9 en este punto
  14.     }
  15. }