Пример #1
0
        private static void RenderObject(Generation.IHtmlWriter writer, object content)
        {
            if (content == null)
                return;

            // render nested control
            if (content is IRenderable)
            {
                ((IRenderable)content).Render(writer);
                return;
            }

            // render text value
            string contentText;
            bool encode;
            if (content is IHtmlContent)
            {
                contentText = ((IHtmlContent)content).GetRawString();
                encode = false;
            }
            else
            {
                contentText = content.ToString();
                encode = true;
            }

            writer.WriteText(contentText, encode);
        }