本文整理汇总了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());
}
示例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();
}
示例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();
}
示例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);
}
示例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();
}
示例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);
}
示例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;
}