我想使用C#将这个数组字符放入一个名为 all 的数组中:
char[] MixedChars = "ABCLMRSjpqvwxyz".ToCharArray();
char[] Digit ="0123456789".ToCharArray();
char[] Punctuation = ",.;:".ToCharArray();
结果将是:
char[] all= "ABCLMRSjpqvwxyz0123456789,.;:".ToCharArray();
答案 0 :(得分:2)
此?
char[] all = MixedChars.Concat(Digit).Concat(Punctuation).ToArray();
答案 1 :(得分:0)
您可以使用Array.CopyTo将所有值复制到all
:
char[] MixedChars = "ABCLMRSjpqvwxyz".ToCharArray();
char[] Digit ="0123456789".ToCharArray();
char[] Punctuation = ",.;:".ToCharArray();
//Create new array with length equal to all values
char[] all = new char[MixedChars.Length + Digit.Length + Punctuation.Length];
//Copy arrays into all
MixedChars.CopyTo(all, 0);
Digit.CopyTo(all, MixedChars.Length);
Punctuation.CopyTo(all, MixedChars.Length + Digit.Length);