Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace TestConsoleApplication
- {
- class Program
- {
- static void Main(string[] args)
- {
- /// Sets the title bar on our console
- Console.Title = "Using Command Line... Like a DOS!";
- /// Set up a integer in local scope, initialising it to zero
- int counter = 0;
- /// Clears the console, like cls (CLear Screen)
- Console.Clear();
- /// Checks if there's any arguments first
- if (args.Length > 0)
- {
- /// If args has been added, then we'll display each one
- foreach (var arg in args)
- {
- Console.Write(arg);
- Console.Write(" ");
- counter++;
- }
- /// Escape string for newline
- Console.Write("\n");
- Console.Write("\nNumber of arguments sent: " + counter);
- Console.Write("\n");
- }
- /// Here's a generic message, like "Hello World" or whatever:
- /// Note: WriteLine adds a carriage return after writing the text
- Console.WriteLine("I can do Computers me!");
- Console.Write("Press the Any key to exit...");
- /// Wait for key-press
- Console.ReadKey(true);
- /* FIN - Exit application */
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement