You typically don't want to try appending to an array in .NET. It can be done, but it's expensive. In this case, you want to use a StringBuilder
Example:
StringBuilder sb = new StringBuilder();
if (abc.Checked)
{
//append lowercase abc
sb.Append(textbox1.Text.ToLower());
}
When you're done, you can get the string by calling sb.ToString()
, or get the characters by calling sb.CopyTo()
.
Naming an array of strings "charArray" is very confusing.
Or are you trying to append strings, not append characters to a string? You want to use a List<string>
for that, rather than a string[]
.
Example:
List<string> strings = new List<string>();
if (abc.Checked)
{
// append lowercase abc
strings.Add(textbox1.Text.ToLower());
}