Mono.Debugger.Frontend.ScriptingContext.FormatObject C# (CSharp) Method

FormatObject() public method

public FormatObject ( object obj, DisplayFormat format ) : string
obj object
format DisplayFormat
return string
        public string FormatObject(object obj, DisplayFormat format)
        {
            string formatted;
            try {
                if (obj is TargetObject) {
                    TargetObject tobj = (TargetObject) obj;
                    formatted = String.Format ("({0}) {1}", tobj.TypeName,
                                   DoFormatObject (tobj, format));
                } else
                    formatted = interpreter.Style.FormatObject (
                        CurrentThread, obj, format);
            } catch {
                formatted = "<cannot display object>";
            }
            return formatted;
        }

Usage Example

Ejemplo n.º 1
0
        public string EvaluateExpression(ScriptingContext context, string text,
						  DisplayFormat format)
        {
            F.Expression expression = context.ParseExpression (text);

            try {
                expression = expression.Resolve (context);
            } catch (ScriptingException ex) {
                throw new ScriptingException ("Cannot resolve expression `{0}': {1}",
                                  text, ex.Message);
            } catch {
                throw new ScriptingException ("Cannot resolve expression `{0}'.", text);
            }

            try {
                object retval = expression.Evaluate (context);
                return context.FormatObject (retval, format);
            } catch (ScriptingException ex) {
                throw new ScriptingException ("Cannot evaluate expression `{0}': {1}",
                                  text, ex.Message);
            } catch {
                throw new ScriptingException ("Cannot evaluate expression `{0}'.", text);
            }
        }
All Usage Examples Of Mono.Debugger.Frontend.ScriptingContext::FormatObject