How to convert string "brakemeup" in to char[stringlength] array?
if i hav开发者_JAVA百科e this code, how can i put alle the chars in my string in to the Char array?
i know this wont compile but the logic shows what im trying to do.
private void button1_Click(object sender, EventArgs e)
{
string stringX = textbox1.Text;
int strlen = stringX.Length();
char[] arrayX = new char[strlen];
arrayX = stringX.Split("");
}
Just use the ToCharArray
method
private void button1_Click(object sender, EventArgs e)
{
string stringX = textbox1.Text;
char[] arrayX = stringX.ToCharArray();
}
char[] arrayX = textbox1.Text.ToCharArray();
How about
stringX.ToCharArray()
精彩评论