本文整理汇总了C#中StringFormatter.Reset方法的典型用法代码示例。如果您正苦于以下问题:C# StringFormatter.Reset方法的具体用法?C# StringFormatter.Reset怎么用?C# StringFormatter.Reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringFormatter
的用法示例。
在下文中一共展示了StringFormatter.Reset方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StringFormatter_CanFormatDoubleArgumentWithDecimalsCommand
public void StringFormatter_CanFormatDoubleArgumentWithDecimalsCommand()
{
var formatter = new StringFormatter();
var buffer = new StringBuilder();
formatter.Reset();
formatter.AddArgument(123.456789);
formatter.Format("this is a Double value: {0:decimals:2}", buffer);
TheResultingString(buffer).ShouldBe("this is a Double value: 123.46");
}
示例2: StringFormatter_CanFormatDoubleArgument
public void StringFormatter_CanFormatDoubleArgument()
{
var formatter = new StringFormatter();
var buffer = new StringBuilder();
formatter.Reset();
formatter.AddArgument(123.45);
formatter.Format("this is a Double value: {0}", buffer);
TheResultingString(buffer).ShouldBe("this is a Double value: 123.45000");
}
示例3: StringFormatter_CanFormatCharArgument
public void StringFormatter_CanFormatCharArgument()
{
var formatter = new StringFormatter();
var buffer = new StringBuilder();
formatter.Reset();
formatter.AddArgument('Z');
formatter.Format("this is a Char value: {0}", buffer);
TheResultingString(buffer).ShouldBe("this is a Char value: Z");
}
示例4: StringFormatter_CanFormatByteArgument
public void StringFormatter_CanFormatByteArgument()
{
var formatter = new StringFormatter();
var buffer = new StringBuilder();
formatter.Reset();
formatter.AddArgument((Byte)123);
formatter.Format("this is a Byte value: {0}", buffer);
TheResultingString(buffer).ShouldBe("this is a Byte value: 123");
}
示例5: StringFormatter_CanFormatStringArgument
public void StringFormatter_CanFormatStringArgument()
{
var formatter = new StringFormatter();
var buffer = new StringBuilder();
formatter.Reset();
formatter.AddArgument("world");
formatter.Format("hello {0}", buffer);
TheResultingString(buffer).ShouldBe("hello world");
}
示例6: StringFormatter_CanFormatBooleanArgument
public void StringFormatter_CanFormatBooleanArgument()
{
var formatter = new StringFormatter();
var buffer = new StringBuilder();
formatter.Reset();
formatter.AddArgument(true);
formatter.AddArgument(false);
formatter.Format("this is {0} and this is {1}", buffer);
TheResultingString(buffer).ShouldBe("this is True and this is False");
}
示例7: Localization_LocalizedTextFormatting
public void Localization_LocalizedTextFormatting()
{
LoadTestLocalizationDatabaseFromXml();
UsingCulture("fr-FR", () =>
{
var formatter = new StringFormatter();
var buffer = new StringBuilder();
formatter.Reset();
formatter.AddArgument(Localization.Get("SWORD").GetPluralVariant(1));
formatter.AddArgument(Localization.Get("GLOWING"));
formatter.Format("test: {?:match:0:def_art}{0} {1:match:0:adj}", buffer);
TheResultingString(buffer)
.ShouldBe("test: l'epée rougeoyante");
formatter.Reset();
formatter.AddArgument(Localization.Get("SWORD").GetPluralVariant(2));
formatter.AddArgument(Localization.Get("GLOWING"));
formatter.Format("test: {?:match:0:def_art}{0} {1:match:0:adj}", buffer);
TheResultingString(buffer)
.ShouldBe("test: les epées rougeoyantes");
});
}