C# Basic Console Application using Variables

June 21, 2007 – 12:34 am

C 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: ,

Post a Comment

Splitzer | CFShare | MySpace Tracker | TrackMySpace Blog | DoDisturb | Windows Hosting | Web Design