/// <summary> /// Convert to string using to_s /// /// The behavior is different from the typical conversion protocol: /// * it assumes that to to_s is defined, and just calls it /// * if to_s returns a non-string value, we fall back to Kernel.ToString /// </summary> public static MutableString /*!*/ ConvertToString(RubyContext /*!*/ context, object obj) { MutableString str = obj as MutableString; if (str != null) { return(str); } str = _ToS.Target(_ToS, context, obj) as MutableString; if (str != null) { return(str); } // fallback to Kernel#to_s if to_s returned a non-string return(KernelOps.ToS(context, obj)); }
private static string GetMessage(object arg2, object arg3) { return(string.Format(CultureInfo.InvariantCulture, "{0} {1}", KernelOps.ToS(arg2), KernelOps.ToS(arg3))); }