Exemple #1
0
        private static @string ToString(object arg)
        {
        #if NET5_0
            Stringer?stringer = arg as Stringer ?? Stringer.As(arg);
        #else
            Stringer?stringer = arg as Stringer ?? typeof(Stringer <>).CreateInterfaceHandler <Stringer>(arg);;
        #endif

            if (!(stringer is null))
            {
                return(stringer.String());
            }

        #if NET5_0
            error?err = arg as error ?? error.As(arg);
        #else
            error?err = arg as error ?? typeof(error <>).CreateInterfaceHandler <error>(arg);
        #endif

            if (!(err is null))
            {
                return(err.Error());
            }

            if (arg is bool)
            {
                return(arg.ToString() !.ToLowerInvariant());
            }

            return(arg?.ToString() ?? "<nil>");
        }
Exemple #2
0
        private static @string ToString(object arg)
        {
            Stringer?stringer = arg as Stringer ?? Stringer.As(arg);

            if (!(stringer is null))
            {
                return(stringer.String());
            }

            error?err = arg as error ?? error.As(arg);

            if (!(err is null))
            {
                return(err.Error());
            }

            if (arg is bool)
            {
                return(arg.ToString() !.ToLowerInvariant());
            }

            return(arg?.ToString() ?? "<nil>");
        }