C# 如何迭代字符串数组 (string[])

你可以使用 foreach 循环来迭代一个字符串数组 (string[])。csharpstring[] str = { 'Hello', 'World', '!' };

foreach (string s in str){ Console.WriteLine(s);}

这将打印出数组中的每个字符串。输出将是:

HelloWorld!

C# 循环遍历字符串数组 (string[])

原文地址: https://www.cveoy.top/t/topic/o8Yo 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录