示例#1
0
        private bool IsEmptyOrWhiteSpaceCore(object entry, EmptyOrWhiteSpaceWriter writer)
        {
            if (entry == null)
            {
                return false;
            }

            var stringValue = entry as string;
            if (stringValue != null)
            {
                // Do not encode the string because encoded value remains whitespace from user's POV.
                if (!string.IsNullOrWhiteSpace(stringValue))
                {
                    return false;
                }
            }
            else
            {
                // Use NullHtmlEncoder to avoid treating encoded whitespace as non-whitespace e.g. "\t" as "	".
                ((IHtmlContent)entry).WriteTo(writer, NullHtmlEncoder.Default);
                if (!writer.IsEmptyOrWhiteSpace)
                {
                    return false;
                }
            }

            return true;
        }
示例#2
0
        private bool IsEmptyOrWhiteSpaceCore(object entry, EmptyOrWhiteSpaceWriter writer)
        {
            if (entry == null)
            {
                return false;
            }

            var stringValue = entry as string;
            if (stringValue != null)
            {
                if (!string.IsNullOrWhiteSpace(stringValue))
                {
                    return false;
                }
            }
            else
            {
                ((IHtmlContent)entry).WriteTo(writer, HtmlEncoder.Default);
                if (!writer.IsEmptyOrWhiteSpace)
                {
                    return false;
                }
            }

            return true;
        }