string MonoObjectToString(TargetClassObject obj)
{
TargetClassType ctype = obj.Type;
if ((ctype.Name == "System.Object") || (ctype.Name == "System.ValueType"))
return null;
string text, dummy;
EE.EvaluationResult result;
if (ctype.DebuggerDisplayAttribute != null) {
result = HandleDebuggerDisplay (Interpreter, CurrentThread, obj,
ctype.DebuggerDisplayAttribute,
-1, out text, out dummy);
if (result == EE.EvaluationResult.Ok)
return String.Format ("{{ {0} }}", text);
else if (result == EE.EvaluationResult.InvalidExpression) {
if (text != null)
return text;
}
}
result = EE.MonoObjectToString (CurrentThread, obj, EE.EvaluationFlags.None, -1, out text);
if (result == EE.EvaluationResult.Ok)
return String.Format ("{{ \"{0}\" }}", text);
return null;
}