开发者

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() 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜