当前位置: 首页>>代码示例>>C#>>正文


C# StringBuilder.AppendJoin方法代码示例

本文整理汇总了C#中StringBuilder.AppendJoin方法的典型用法代码示例。如果您正苦于以下问题:C# StringBuilder.AppendJoin方法的具体用法?C# StringBuilder.AppendJoin怎么用?C# StringBuilder.AppendJoin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StringBuilder的用法示例。


在下文中一共展示了StringBuilder.AppendJoin方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AppendJoinTest

        public void AppendJoinTest()
        {
            var builder = new StringBuilder();

            builder.AppendJoin(Enumerable.Repeat("a", 4), "");
            Assert.AreEqual("aaaa", builder.ToString());
            builder.Append(" ");
            builder.AppendJoin(Enumerable.Range(0, 5).Select(i => (i * 2).ToString()), ";");
            Assert.AreEqual("aaaa 0;2;4;6;8", builder.ToString());
        }
开发者ID:ShomreiTorah,项目名称:Libraries,代码行数:10,代码来源:ExtensionsTest.cs

示例2: FormatDelegate

        private string FormatDelegate(Type type)
        {
            var builder = new StringBuilder();
            var invoke = type.GetMethod("Invoke");
            var parameters = invoke.GetParameters();

            if (parameters.Length > 1)
                builder.Append("(");

            builder.AppendJoin(",", parameters.Select(p => Format(p.ParameterType)));

            if (parameters.Length > 1)
                builder.Append(")");

            builder.Append(" => ");
            builder.Append(Format(invoke.ReturnType));
            return builder.ToString();
        }
开发者ID:izobr,项目名称:light,代码行数:18,代码来源:TypeFormatter.cs

示例3: DisplayLabel

        public static string DisplayLabel(this MethodInfo method)
        {
            var sb = new StringBuilder();

            sb
                .Append(method.ReturnType.FullName)
                .Append(" ")
                .Append(method.DeclaringType.FullName)
                .Append(".")
                .Append(method.Name);

            if (method.IsGenericMethod)
            {
                sb.Append("<");
                sb.AppendJoin(", ", method.GetGenericArguments().Select(x => x.Name));
                sb.Append(">");
            }

            sb.Append("(")
              .AppendJoin(", ", method.GetParameters().Select(x => (x.ParameterType.FullName ?? x.ParameterType.Name) + " " + x.Name))
              .Append(")");

            return sb.ToString();
        }
开发者ID:Novakov,项目名称:HighLevelCodeAnalysis,代码行数:24,代码来源:ReflectionExtensions.cs

示例4: CreateParser

        static Regex CreateParser()
        {
            StringBuilder text = new StringBuilder(@"^\s*");
            text.Append(@"(");

            text.AppendJoin(
                RelationMatchers
                    .Select(r => r.ToString().TrimStart('^').TrimEnd('$'))	//Remove the anchors
                    .OrderByDescending(r => r.Length),
                "|"
            ).Append('|').Append(Regex.Escape(EmptyRelative));

            text.Append(@")?");
            text.Append(@"\s*[,.;/\\]?\s*");
            text.Append(@"(מתנה|Matanah?)?");	//TODO: Allow prefix מתנה
            text.Append(@"\s*[,.;/\\]?\s*");
            text.Append(@"(.*)");
            text.Append(@"\s*$");
            return new Regex(text.ToString(), RegexOptions.IgnoreCase | RegexOptions.Compiled);
        }
开发者ID:ShomreiTorah,项目名称:Libraries,代码行数:20,代码来源:AliyahNote.cs

示例5: ToString

        public override string ToString()
        {
            var numberOfChildren = InternalChildren.Count;
            var sb = new StringBuilder();

            if (numberOfChildren > 10)
                sb.Append(numberOfChildren).Append(" children\n");
            else
                sb.Append("Children:\n    ").AppendJoin("\n    ", InternalChildren.AllMinToMax, ChildStatsAppender).Append('\n');

            var numberToDie = _toDie.Count;
            sb.Append(numberToDie).Append(" children terminating:\n    ");
            sb.AppendJoin("\n    ", _toDie.AllMinToMax);

            return sb.ToString();
        }
开发者ID:MaciekLesiczka,项目名称:akka.net,代码行数:16,代码来源:TerminatingChildrenContainer.cs

示例6: CreateErrors

        //Creates labels for errors.
        internal void CreateErrors()
        {
            GUILayout.Label("General:", this.skins.label);
            StringBuilder builder = new StringBuilder();
            builder.AppendJoin(GetErrors(true), "\n");
            GUILayout.Label(builder.ToString(), GUIUtils.redLabel);
            GUILayout.Space(10);

            GUILayout.Label("Chutes:", this.skins.label);
            builder = new StringBuilder();
            builder.AppendJoin(GetErrors(false), "\n");
            GUILayout.Label(builder.ToString(), GUIUtils.redLabel);
            GUILayout.Space(10);
        }
开发者ID:pcwilcox,项目名称:RealChute,代码行数:15,代码来源:ProceduralChute.cs

示例7: BuildSelectCommand

        ///<summary>Builds a SELECT command for the given schema.</summary>
        ///<returns>
        ///SELECT [FirstColumn], [SecondColumn], [RowVersion]
        ///FROM [SchemaName].[TableName]
        ///</returns>
        protected StringBuilder BuildSelectCommand(SchemaMapping schema)
        {
            if (schema == null) throw new ArgumentNullException("schema");

            var sql = new StringBuilder();

            sql.Append("SELECT ");
            sql.AppendJoin(
                schema.Columns.Select(c => c.SqlName.EscapeSqlIdentifier()), ", "
            );
            sql.AppendLine(", [RowVersion]");
            sql.Append("FROM ").Append(QualifyTable(schema));

            return sql;
        }
开发者ID:ShomreiTorah,项目名称:Libraries,代码行数:20,代码来源:SqlServerSqlProvider.cs


注:本文中的StringBuilder.AppendJoin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。