Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Last active December 25, 2015 01:19
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/6894176 to your computer and use it in GitHub Desktop.
Save Fhernd/6894176 to your computer and use it in GitHub Desktop.
Demostración de los miembros CommandLine y GetCommandLineArgs en C#.
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