在C#中,如果我们想要创建一个类型的变量,string我们可以使用:
string str="samplestring"; // this will allocate the space to hold the string
Run Code Online (Sandbox Code Playgroud)
在C#中,string是一个类类型,所以如果我们想要创建一个对象,通常我们必须使用该new关键字.那么如果没有new或如何发生分配constructors呢?
c# ×1