Asp.net programming we consider all important topic for knowledge about controls,web Services, JSON, Ajax, database, and interview related Question. In this Asp.net and sql server tutorial blog we give many examples of jquery as like How Play YouTube Video in Your Asp.net Website by URL, How to Play YouTube Videos in Asp.net by using Jquery , Jquery Change div background on mouseover in asp.net , JQuery UI Datepicker (Calendar) etc.

Wednesday, September 24, 2014

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.");          

No comments:

Post a Comment