private void InversaoString(string Texto, int Tamanho)
{
char[] arrChar = Texto.ToCharArray();
char arrChar2;
int indice = 0;
for(Tamanho = arrChar.Length-1; Tamanho>=0; Tamanho--)
{
arrChar2(indice) = arrChar;
indice++;
}
string Novo = new string(arrChar2);
txtSaida.Text = Novo;
}
See that I copy the string Texto
to an array. Right now I create another array, but it has a but I want arrChar2
to have the same size as arrChar
, I tried to use the Length
method but without success. How should I proceed?
(I want to do this because I want to invert the Text string).