String
is a class like other classes in any Object oriented programming language and we can create object of it using new
keyword like we would do for creating object of any type.
In your specific scenario above you have a char
array and String
class have a constructor overload which take char[]
as input and create a String
. So you call the constructor using new String
.
So what is happening is you said to create an object of type string using char[]
which is provided in the constructor of it.
2
solved The symbol ‘new’ in C#, what is its use? [closed]