コード例 #1
0
        public static string GetParameterInfoRTF([NotNull] PropertyInfo property)
        {
            Assert.ArgumentNotNull(property, nameof(property));

            string displayType = GetParameterDisplayType(property);
            string description = GetParameterDescription(property);

            var rtf = new RichTextBuilder();

            rtf.FontSize(8);
            rtf.Bold(property.Name).Text(" (").Text(displayType).Text(")");
            rtf.LineBreak();
            rtf.Text(description);

            return(rtf.ToRtf());
        }
コード例 #2
0
ファイル: RichTextBuilderTest.cs プロジェクト: ujr/csutils
        public void CanFormattedText()
        {
            var builder = new RichTextBuilder();

            builder.LineLimit = 999;             // long lines are fine for this test
            builder.Text("This is ").Bold("bold").Text(" and ").Italic("italic").Text(" text.");
            builder.LineBreak();
            builder.Text("And this is ");
            builder.Begin().Bold().Italic().Text("Bold Italic").End().Text(" text.");
            var rtf = builder.ToRtf();

            _output.WriteLine(rtf);
            int i = rtf.IndexOf("This is ", StringComparison.Ordinal);

            Assert.True(i > 0);
            Assert.Equal(
                @"This is {\b bold} and {\i italic} text.\line And this is {\b\i Bold Italic} text.}",
                rtf.Substring(i));
        }