コード例 #1
0
        public StringBuilderInterlaced Insert(StringBuilderInterlaced writer)
        {
            foreach (var coloredString in writer._source)
            {
                _source.Add(coloredString);
            }

            return(this);
        }
コード例 #2
0
        public static void WriteToStreamAsHtml(this TextWriter writer, StringBuilderInterlaced source)
        {
            source.WriteToSteam(writer, (forg, backg) =>
            {
                var color = "";
                if (forg.HasValue)
                {
                    color += "color=" + forg.Value;
                }

                if (backg.HasValue)
                {
                    if (forg.HasValue)
                    {
                        color += ",";
                    }

                    color += "background-color=" + backg.Value;
                }

                writer.Write("<p style=\"{0}\">", color);
            }, () => { writer.Write("</p>"); });
        }