C# Basic Console Application using Variables
June 21, 2007 – 12:34 amC Sharp provides neat functionality to build a console application. The following example is a really simple one using variables with classes defined.
Â
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication4
{
   class Program
   {
       static void Main(string[] args)
       {
           string firstName;
           string lastName;
           Variables(out firstName, out lastName);
           Console.WriteLine(firstName);
           Console.WriteLine(“Please, press enter to contineue”);
           Console.ReadLine();     Â
           Console.WriteLine(lastName);
           Console.WriteLine(“Thank you for using our program!”);
           Console.ReadLine();
       }
       private static void Variables(out string firstName, out string lastName)
       {
           firstName = “David”;
           lastName = “Peterson”;
       }
   }
}
Â
Console application as you know is not a GUI, which is not common these days, but the command prompt is still being used, so it will be a nice idea to get a hands on training. Â
Tags: c#, console application