gpt4 book ai didi

c# - 如何从 char 数组中包含的值初始化一个新的字符串数组?

转载 作者:行者123 更新时间:2023-11-30 19:22:08 24 4
gpt4 key购买 nike

我想从 char 数组中包含的值初始化一个新的字符串数组。
这可能不使用列表吗?

这是我目前所拥有的:

char[] arrChars = {'a', 'b', 'c'};
string[] arrStrings = new string[](arrChars);

最佳答案

string[] arrStrings = Array.ConvertAll(arrChars, c => c.ToString());

关于c# - 如何从 char 数组中包含的值初始化一个新的字符串数组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1674575/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com