Why is new String(“Hello”) invalid in C#?

后端 未结 9 2349
太阳男子
太阳男子 2021-02-19 03:41

What is the logic/reason behind making

String s= new String(\"Hello World\");

Illegal in C#? The error is

The best over

9条回答
  •  北海茫月
    2021-02-19 04:23

    It would give the impression that the string is being cloned, but strings are immutable.

提交回复
热议问题