Strings ( string
) in C # are immutable. This means that they can not be modified once created.
You could use StringBuilder
, as follows:
StringBuilder caracter= new StringBuilder("");
caracter[0] = (char)27;
Although if, as it seems, you want to store a character, why not use char
directly?
char c;
c=(char)27;
Edited
After reading your comment, another more logical option if you want an array of characters, is to use a char collection:
char[] caracteres = new char[10];
caracteres[6] = 's';
Edited 2
is to be able to implement an algorithm that reads numbers and prints the value in letters
In that case, what you should do is store the numbers in the collection (array, List
..) and only convert them to their representation later.
int[] numeros= new int[numerodeelementos];
o
List<int> numeros = new List<int>();