Example #1
0
        /// <summary> Synchronously invoke the method </summary>
        public static Value InvokeMethod(Value objectInstance, MethodInfo methodInfo, params Value[] arguments)
        {
            CheckObject(objectInstance, methodInfo);

            return(Eval.InvokeMethod(
                       (DebugMethodInfo)methodInfo,
                       methodInfo.IsStatic ? null : objectInstance,
                       arguments ?? new Value[0]
                       ));
        }
Example #2
0
        /// <summary> Invoke the ToString() method </summary>
        public string InvokeToString(int maxLength = int.MaxValue)
        {
            if (this.Type.IsPrimitive)
            {
                return(AsString(maxLength));
            }
            if (this.Type.FullName == typeof(string).FullName)
            {
                return(AsString(maxLength));
            }
            if (this.Type.IsPointer)
            {
                return("0x" + this.PointerAddress.ToString("X"));
            }
            // if (!IsObject) // Can invoke on primitives
            DebugMethodInfo methodInfo = (DebugMethodInfo)this.AppDomain.ObjectType.GetMethod("ToString", new DebugType[] { });

            return(Eval.InvokeMethod(methodInfo, this, new Value[] { }).AsString(maxLength));
        }