As we know C# is an object-oriented programming language. Like other OOP languages, the C# program also consists of objects to interact with other actions called Methods. Some objects having same kind are said to be in same class
The basic C# program syntax is given below:
Syntax:
using System;
namespace syntax
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("C# Syntax!");
Console.ReadLine();
}
}
}
Keywords:
Using Keyword: The first statement in C# program is known as the “using Keyword”. In C# program this keyword is used to include the namespaces. A C# program can have more tha one using statements.
using System;
Class Keyword: This is used to declare a class in C# program.
Comments:
In C# syntax comments are used to explain code. Comments are ignored by the compiler.
Single-line comments are indicated by the ‘//’ symbol.
}//end class syntax
Multiple comments start with /* and terminate with the characters */ .
/* The basic structure of adding multiple comments in single program */
Member Functions:
Statements used to perform specific tasks are known as Functions. We declare the member functions in the class.
Member Variables:
Attributes or data members of a class are known as Variables. Variables are used to store data.