if i have 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();
怎么样
stringX.ToCharArray()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.