/// <summary>
        /// Determines what to do when an Invalid Selector is found.
        ///
        /// Returns True if we should just continue; False if we should skip this item.
        /// </summary>
        private bool OnInvalidSelector(string format, CustomFormatInfo info, PlaceholderInfo placeholder)
        {
            string invalidSelector = format.Substring(placeholder.selectorStart, placeholder.selectorLength);

            string message;

            switch (InvalidSelectorAction)
            {
            case ErrorAction.ThrowError:
                //  Let's give a detailed description of the error:
                message = FormatEx(
                    ("Invalid Format String.\\n" +
                     ("Could not evaluate \"{0}\": \"{1}\" is not a member of {2}.\\n" +
                      ("The error occurs at position {3} of the following format string:\\n" + "{4}"))),
                    invalidSelector, info.Selector, info.CurrentType, placeholder.placeholderStart, format);
                throw new ArgumentException(message, invalidSelector);

            case ErrorAction.OutputErrorInResult:
                //  Let's put the placeholder back,
                //  along with the error.
                //  Example: {Person.Name.ABC}  becomes  {Person.Name.ABC:(Error: "ABC" is not a member of String)}
                message = ("{" + (FormatEx("{0}:(Error: \"{1}\" is not a member of {2})", invalidSelector,
                                           info.Selector, info.CurrentType) + "}"));
                info.WriteError(message, placeholder);
                return(false);

            case ErrorAction.Ignore:
                //  Allow formatting to continue!
                break;
            }
            return(true);
        }
        /// <summary>
        /// Determines what to do when an Invalid Selector is found.
        /// </summary>
        private void OnInvalidFormat(string format, CustomFormatInfo info, PlaceholderInfo placeholder, Exception ex)
        {
            string selector      = format.Substring(placeholder.selectorStart, placeholder.selectorLength);
            string invalidFormat = format.Substring(placeholder.formatStart, placeholder.formatLength);
            string errorMessage  = ex.Message;

            if (ex is FormatException)
            {
                errorMessage = FormatEx("\"{0}\" is not a valid format specifier for {1}", invalidFormat,
                                        info.CurrentType);
            }

            string message;

            switch (InvalidFormatAction)
            {
            case ErrorAction.ThrowError:
                //  Let's give a detailed description of the error:
                message = FormatEx(
                    ("Invalid Format String.\\n" +
                     ("Could not evaluate {{0}} because {1}.\\n" +
                      ("The error occurs at position {2} of the following format string:\\n" + "{3}"))), selector,
                    errorMessage, placeholder.placeholderStart, format);
                throw new ArgumentException(message, invalidFormat, ex);

            case ErrorAction.OutputErrorInResult:
                //  Let's put the placeholder back,
                //  along with the error.
                //  Example: {Person.Birthday:x}  becomes  {Person.Birthday:(Error: "x" is an invalid format specifier)}
                message = ("{" + (FormatEx("{0}:(Error: {1})", selector, errorMessage) + "}"));
                info.WriteError(message, placeholder);
                break;

            case ErrorAction.Ignore:
                //  Allow formatting to continue!
                break;
            }
        }