@John.He ,
foreach (var textFragment in textFragmentCollection)
{
var text = textFragment.Text;
//var str = string.Empty;
textFragment.Text = string.Empty;
if (text.Contains("\r\n"))
{
text = text.Replace("\r\n", "").Replace("[", "").Replace("]", "");
}
else
{
text = text.Replace("[", "").Replace("]", "");
}
textFragment.Text = text;
Console.WriteLine($"Text Fragment :{textFragment.Text}");
textFragment.TextState.ForegroundColor = foregroundColor;
textFragment.TextState.BackgroundColor = backgroundColor;
}
textFragments initial value is “[Reas\r\non]”. I would like to replace square braces with empty string.
textFragment.Text = text;
it does not allow me to override textFragments.Text value with text and throws the above mentioned exception.