How to write first programme in c sharp

A First C# Program
Here is a program that multiplies 15 by 45 and prints the result, 675, to the screen.
The double forward slash indicates that the remainder of a line is a comment.
using System; // Importing namespace
class Test // Class declaration
static void Main() // Method declaration
int x = 15 * 45; // Statement 1
Console.WriteLine (x); // Statement 2
} // End of method
} // End of class
At the heart of this program lie two statements:
int x = 15 * 45;
Console.WriteLine (x);


A method performs an action in a series of statements, called a statement block—a
pair of braces containing zero or more statements. We defined a single method
named Main:
static void Main()



static void Main()
C# recognizes a method called Main as signaling the default entry point of execution.
The Main method may optionally return an integer (rather than void) in order to
return a value to the execution environment (where a non-zero value typically indicates
an error). The Main method can also optionally accept an array of strings as a
parameter (that will be populated with any arguments passed to the executable).

Methods are one of several kinds of functions in C#. Another kind of function we
used was the * operator, used to perform multiplication. There are also constructors,
properties, events, indexers, and finalizers.