Thursday, 24 September 2015

USING ALIASES FOR CLASS

Program P2:/*A program using aliases for class and command line arguments*/
using A=System.Console;                                     //A is alis for System.Console
class Sample
{
    public static void Main(string[ ] args)
    {
       A.WriteLine("welcometo");                           // Write can also be used in place of WriteLine
        A.WriteLine(" ",args[0]);                                  //command Line argument
        A.WriteLine(" ",args[1]);
    }
}

Command Line aruguments  are parameters suplied to the maine method at the time of invoking it for execution.args  that is given as the Main method parameter,is an array of strings. Arguments provided in the command line are passed to the arrayargs.
Also,C# is a platform free language, we need not to indent any line.

No comments:

Post a Comment