C# language Program Structure

C# programming language Program Structure (way of write a program):




Before we study basic building blocks of the C# programming language, let us look at a bare minimum C#. Program structure so that we can take it as a reference in upcoming chapters.

C#, how to display message in consol, Example:

Console.WriteLine("hello this is my first program.");

A C# program basically consists of the following parts:

  • Namespace declaration
  • A class
  • Class methods
  • Class attributes
  • A Main method
  • Statements & Expressions
  • Comments

Now we take an Example for give the message:

1.Open IDE:


2.Go to file menu -> new -> project.




3.Select window and console application. Then give the name of project and click on ok.


Write fallowing code on page and run .
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("");
            Console.WriteLine("hello this is my first program.");
            Console.WriteLine("this is my asp.net tutorials notes");
            Console.ReadKey();
        }
    }

Result of this C# Program:



In this program we simple print a message in consol. For print anything on consol we use fallowing commend or instruction with C# program.

 Console.WriteLine("hello this is my first program.");          

Comments

  1. Learn how to Calculate Running Total, Total of a Column and Row
    sql query for running total

    ReplyDelete
  2. It is nice blog Thank you provide important information and i am searching for same information to save my time Big data hadoop online Training

    ReplyDelete
  3. nice explanation this articles are more helpful for beginners

    ReplyDelete

Post a Comment

Popular posts from this blog