What are punctuators in C#?

CsharpProgrammingServer Side Programming

Punctuators are used in C# as special symbols to a group or divide the code. It includes −

] () {}, ; * = #

For example, = gets included in a class or even while declaring a variable. Statement ends with a semi-colon −

int a = 10;

In a class, the braces are used −

class Demo {
}

While declaring a dictionary −

var d = new Dictionary<string, int>(5);

It is also used while declaring and initializing a list −

List<string> myList = new List<string>() {
   "mammals",
   "reptiles",
   "amphibians"
};
raja
Published on 13-Aug-2018 08:47:07
Advertisements