字符串中的 Join() 方法使用指定的分割符连接字符串数组的所有元素。在下面的示例中,我们有一个多行字符串,并将分隔符设置为 “” - String.Join("", starray); 示例 以下是完整的示例 - 实时演示 using System; namespace StringApplication { class StringProg { static void Main(string[] args) { string[] starray = new string[]{"Down the way nights are dark", "And the sun shines daily on the mountaintop", "I took ... 阅读更多
Const 常量字段是不能修改的字段。在声明时,需要为其赋值。const int a = 5; Readonly 只读字段在声明时初始化,也可以在构造函数中设置。让我们来看一个在构造函数中初始化只读字段的示例 - 示例 class Calculate { readonly int z; public Demo( ) { z = 20; } }