Last active
December 25, 2015 01:19
-
-
Save Fhernd/6894176 to your computer and use it in GitHub Desktop.
Demostración de los miembros CommandLine y GetCommandLineArgs en C#.
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; | |
public class Suma | |
{ | |
public static void Main () | |
{ | |
// Presenta todos los argumentos capturados, e incluido, | |
// el nombre del archivo de la aplicación. | |
Console.WriteLine (Environment.CommandLine); | |
// acumulador de la suma de los números pasados como argumentos | |
double suma = 0.0; | |
foreach (string s Environment.GetCommandLineArgs()) | |
{ | |
suma += Convert.ToDouble (s); | |
} | |
Console.WriteLine ("La suma es {0}.", suma); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment