Monday, 28 July 2014

How to Reading and Writing to Console in Csharp

Interactive Programs in Csharp

Writing and Reading in Console Window

Console.ReadLine();

Console.WriteLine();


   
    
using System;
public class Hello1
{
    public static void Main(String[] args)

    {
        // This is For Printing a message in Console.
        Console.WriteLine("How to Read and Write to Console ");


        // This is For Reading a string (Text) from user given as input as FirstName
        string Firstname = Console.ReadLine();

        // This is For Printing FirstName in Console.
        Console.WriteLine("user Entered First Name: {0}",Firstname );

        // This is For Reading a string (Text) from user given as input as LastName
        string Lastname = Console.ReadLine();
        // This is For Printing LastName in Console.
        Console.WriteLine("user Entered LastName: {0}",Lastname);
        Console.ReadLine();
    }    
 

Output

How to Reading and Writing to Console in Csharp

 



Tuesday, 22 July 2014

Simple C# Program

Using System Declaration

The namespace declaration, using System,indicates that you are using the System namespace.
A Namespace is used to organize your code and is collection of classes, interfaces, structs, enums and delegates.

   
    
 Using System;
 Class Program
{
static Void Main()
{
Console.WriteLine("Welcome to C# Training");

}

}
       
 

Output

Three Methods to get the output
1. Go to Vistual Studio
2. On the Top Menu bar find the Debug Menu
3. Click on Start Debugging or Start Without Debugging
4. Now Get the output.