What are punctuators in C#?


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"
};

karthikeya Boyini
karthikeya Boyini

I love programming (: That's all I know

Updated on: 21-Jun-2020

277 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements