Thus, you should never have a no-argument constructor for an immutable class.
因此,您永远都不该为一个不可变类提供一个无参数的构造函数。
An immutable class that meets the previous requirements appears in Listing 1.
清单1中列出了一个满足上述要求的不可变类。
Using this style of code is a strong visual indicator that it's an immutable class.
这种代码风格的使用从视觉上给出了一种强烈的指示:该类是一个不可变类。
The following example shows two ways to implement an immutable class that has auto-implemented properties.
下面的示例演示两种方法来实现具有自动实现属性的不可变类。
The following example shows two ways to implement an immutable class that has auto-implemented properties.
下面的示例演示两种方法来实现具有自动实现属性的不可变类。
应用推荐