小编sam*_*sam的帖子

String对象如何在没有new关键字或构造函数的情况下分配内存?

在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#

6
推荐指数
2
解决办法
7891
查看次数

标签 统计

c# ×1