/// <summary>
        /// Renders the detail object to a <see cref="StringBuilder"/>
        /// </summary>
        /// <param name="context">The rendering context</param>
        protected override void DoRender(RenderContext <IDictionary> context)
        {
            ErrorTableRenderer.RenderTableStart(context.Builder);
            ErrorTableRenderer.RenderTableKeyValueHeading(context.Builder, b => b.Append("Key"), b => b.Append("Value"));

            foreach (DictionaryEntry entry in context.ObjectToRender)
            {
                ITypeRenderer keyRenderer   = UtilityMethods.ChooseTypeRenderer(entry.Key, context.TypeRenderers);
                ITypeRenderer valueRenderer = UtilityMethods.ChooseTypeRenderer(entry.Value, context.TypeRenderers);

                ErrorTableRenderer.RenderKeyValueRow(context.Builder, b => keyRenderer.Render(context.Copy(entry.Key, b)), b => valueRenderer.Render(context.Copy(entry.Value, b)));
            }

            ErrorTableRenderer.RenderTableEnd(context.Builder);
        }
        /// <summary>
        /// Renders the detail object to a <see cref="StringBuilder"/>
        /// </summary>
        /// <param name="context">The rendering context</param>
        protected override void DoRender(RenderContext <NameValueCollection> context)
        {
            ErrorTableRenderer.RenderTableStart(context.Builder);
            ErrorTableRenderer.RenderTableKeyValueHeading(context.Builder, b => b.Append("Key"), b => b.Append("Value"));

            foreach (string key in context.ObjectToRender.AllKeys)
            {
                ITypeRenderer keyRenderer   = UtilityMethods.ChooseTypeRenderer(key, context.TypeRenderers);
                ITypeRenderer valueRenderer = UtilityMethods.ChooseTypeRenderer(context.ObjectToRender[key], context.TypeRenderers);

                ErrorTableRenderer.RenderKeyValueRow(context.Builder, b => keyRenderer.Render(context.Copy((object)key, b)), b => valueRenderer.Render(context.Copy((object)context.ObjectToRender[key], b)));
            }

            ErrorTableRenderer.RenderTableEnd(context.Builder);
        }
Esempio n. 3
0
        /// <summary>
        /// Renders the detail object to a <see cref="StringBuilder"/>
        /// </summary>
        /// <param name="context">The rendering context</param>
        protected override void DoRender(RenderContext <IEnumerable> context)
        {
            ErrorTableRenderer.RenderTableStart(context.Builder);
            ErrorTableRenderer.RenderTableKeyValueHeading(context.Builder, b => b.Append("Index"), b => b.Append("Value"));

            int i = 0;

            foreach (object obj in context.ObjectToRender)
            {
                ITypeRenderer objRenderer = UtilityMethods.ChooseTypeRenderer(obj, context.TypeRenderers);

                ErrorTableRenderer.RenderKeyValueRow(context.Builder, b => b.Append(i), b => objRenderer.Render(context.Copy(obj, b)));
                i++;
            }

            ErrorTableRenderer.RenderTableEnd(context.Builder);
        }