Created
September 27, 2014 14:51
-
-
Save Fhernd/a2d0de25fdf7fa997dd6 to your computer and use it in GitHub Desktop.
Uso del calificador de parámetro `out`.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Articulos.Pregunta.P1020 | |
{ | |
public sealed class UsoOut | |
{ | |
public static void Main() | |
{ | |
// Creación de variable entera de 32 bits. | |
// La variable no se le asigna: | |
int i; | |
// Invocación del método `ModificarTipoPorValor`: | |
ModificarTipoPorValor (out i); | |
// Muestra el valor actual después de invocar al método `ModificarTipoPorValor`: | |
Console.WriteLine ("\nValor `i` después de invocar al método `ModificarTipoPorValor`: {0}\n", | |
i.ToString() | |
); | |
} | |
// Método que modifica una variable de tipo por | |
// valor por medio de la calificador de parámetro ref: | |
private static void ModificarTipoPorValor(out int i) | |
{ | |
i = 24; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment