本文整理汇总了C#中this.AppendFormat方法的典型用法代码示例。如果您正苦于以下问题:C# this.AppendFormat方法的具体用法?C# this.AppendFormat怎么用?C# this.AppendFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类this
的用法示例。
在下文中一共展示了this.AppendFormat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Filter
public static void Filter(this StringBuilder builder, string field, string value, bool and = true)
{
if (builder.Length > 0)
builder.AppendFormat(" {0} ", and ? "and" : "or");
builder.AppendFormat("{0} eq '{1}'", field, value);
}
示例2: WriteHttpTrace
public static void WriteHttpTrace(this StringBuilder stringBuilder, HttpMessageHeader messageHeader)
{
if (messageHeader == null)
{
return;
}
stringBuilder
.AppendFormat("StartLine: {0}", messageHeader.StartLine)
.AppendLine();
var headers = messageHeader.Headers.Lines.ToList();
if (headers.Count == 0)
{
return;
}
stringBuilder.AppendLine("Headers:");
foreach (var header in headers)
{
stringBuilder
.AppendFormat(" {0}", header)
.AppendLine();
}
}
示例3: Filter
public static void Filter(this StringBuilder builder, string field, DateTime value, string op, bool and = true)
{
if (builder.Length > 0) builder.AppendFormat(" {0} ", and ? "and" : "or");
builder.AppendFormat("(");
builder.AppendFormat("{0} {1} {2}", field, op, AzureSearchHelper.ConvertToOffset(value).ToString("u").Replace(" ", "T"));
builder.AppendFormat(")");
}
示例4: AppendTriggerable
private static void AppendTriggerable(this StringBuilder builder, Triggerable triggerable)
{
builder.AppendLine(" [TRIGGERABLE]");
builder.AppendFormat(" <STRING>Name:{0}\r\n", triggerable.Name);
builder.AppendFormat(" <STRING>File:{0}\r\n", triggerable.File);
builder.AppendLine(" [/TRIGGERABLE]");
}
示例5: AppendSkill
private static void AppendSkill(this StringBuilder builder, Skill skill)
{
builder.AppendLine(" [SKILL]");
builder.AppendFormat(" <INTEGER64>GUID:{0}\r\n", skill.GUID);
builder.AppendFormat(" <STRING>Name:{0}\r\n", skill.Name);
builder.AppendFormat(" <STRING>File:{0}\r\n", skill.File);
builder.AppendLine(" [/SKILL]");
}
示例6: AppendAffix
private static void AppendAffix(this StringBuilder builder, Affix affix)
{
builder.AppendLine(" [AFFIX]");
builder.AppendFormat(" <STRING>Name:{0}\r\n", affix.Name);
builder.AppendFormat(" <STRING>File:{0}\r\n", affix.File);
builder.AppendFormat(" <INTEGER>MinSpawnRange:{0}\r\n", affix.MinSpawnRange);
builder.AppendFormat(" <INTEGER>MaxSpawnRange:{0}\r\n", affix.MaxSpawnRange);
builder.AppendFormat(" <INTEGER>Weight:{0}\r\n", affix.Weight);
builder.AppendFormat(" <INTEGER>DifficultiesAllowed:{0}\r\n", affix.DifficultiesAllowed);
if (affix.UnitTypes.Count > 0)
{
builder.AppendLine(" [UNITTYPES]");
foreach (var unitType in affix.UnitTypes)
{
builder.AppendFormat(" <STRING>{0}\r\n", unitType);
}
builder.AppendLine(" [/UNITTYPES]");
}
if (affix.NotUnitTypes.Count > 0)
{
builder.AppendLine(" [NOTUNITTYPES]");
foreach (var unitType in affix.NotUnitTypes)
{
builder.AppendFormat(" <STRING>{0}\r\n", unitType);
}
builder.AppendLine(" [/NOTUNITTYPES]");
}
builder.AppendLine(" [/AFFIX]");
}
示例7: AppendLine
public static void AppendLine(this StringBuilder self, String format, params Object[] args)
{
Check.Argument(self, "self");
self.AppendFormat(format, args);
self.AppendLine();
}
示例8: AppendFormatIfNotNull
public static void AppendFormatIfNotNull(this StringBuilder sb, object parameter, string value, params object[] args)
{
if (parameter != null)
{
sb.AppendFormat(value, args);
}
}
示例9: AppendFormatIfNotNullOrEmpty
public static void AppendFormatIfNotNullOrEmpty(this StringBuilder sb, string parameter, string value)
{
if (!string.IsNullOrEmpty(parameter))
{
sb.AppendFormat(value, parameter);
}
}
示例10: AppendFormatIfFalse
public static void AppendFormatIfFalse(this StringBuilder sb, bool parameter, string value, params object[] args)
{
if (!parameter)
{
sb.AppendFormat(value, args);
}
}
示例11: AppendFormatIfNotZero
public static void AppendFormatIfNotZero(this TextBoxBase textbox, string format, float arg)
{
Contract.Requires(format != null);
if (arg != 0.0f)
textbox.AppendFormat(format, arg);
}
示例12: AppendProperty
private static void AppendProperty(this StringBuilder sb, string addition)
{
if (sb.Length > 0)
sb.AppendFormat(",{0}", addition);
else
sb.Append(addition);
}
示例13: AppendNonNullOrEmpty
public static StringBuilder AppendNonNullOrEmpty(this StringBuilder sb, string format, object arg0, int padLeftWidth = 0)
{
if (arg0 == null) return sb;
if (arg0.GetType().FullName == "System.String" && string.IsNullOrWhiteSpace(arg0.ToString()))
return sb;
return sb.AppendFormat(format, arg0).PadLeft(padLeftWidth);
}
示例14: AppendFormatLineIfNotNull
public static void AppendFormatLineIfNotNull(this RichTextBox builder, string format, uint arg, object s)
{
if (arg != 0)
{
builder.AppendFormat(format+Environment.NewLine, arg,s);
}
}
示例15: AppendLineFormat
public static StringBuilder AppendLineFormat(this StringBuilder builder, string format, params object[] args)
{
builder.AppendFormat(format, args);
builder.AppendLine();
return builder;
}