You declared a CD type delegate in your Append call and ToString() is called on it, which returns the default type name, i.e. "MyNamespace.MyClass + CD".
You need to call a delegate to get it for evaluation, for example:
void MyFunction() { stringBuilder.Append(((CD)delegate { switch (whatever) { case 1: return "A"; ... default: return "X"; } }).Invoke()); }
source share