本文整理汇总了C#中System.StringComparison.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# StringComparison.ToString方法的具体用法?C# StringComparison.ToString怎么用?C# StringComparison.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.StringComparison
的用法示例。
在下文中一共展示了StringComparison.ToString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EqualsTest
void EqualsTest(StringComparison compare, int count)
{
Console.WriteLine("\r\na.Equals(b, StringComparison.{0}):",compare.ToString());
Stopwatch watch = new Stopwatch();
watch.Start();
for (int i = 0; i < count; i++)
{
bool re = a.Equals(b, compare);
}
watch.Stop();
double time = watch.Elapsed.TotalSeconds;
Console.Write(time);
}
示例2: Test6
public virtual object Test6(object x, StringComparison sc) {
return "C# Test6" + x.ToString() + sc.ToString();
}
示例3: Test5
public virtual object Test5(StringComparison sc) {
return "C# Test5" + sc.ToString();
}
示例4: CreateStringEqualsExpression
protected CodeExpression CreateStringEqualsExpression(StringComparison stringComparison, CodeExpression left, CodeExpression right)
{
if (left == null) throw new ArgumentNullException("left");
if (right == null) throw new ArgumentNullException("right");
return new CodeMethodInvokeExpression(new CodeTypeReferenceExpression(typeof(string)), "Equals", left, right,
new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(typeof(StringComparison)), stringComparison.ToString()));
}
示例5: ShouldStartWith
public static void ShouldStartWith(this string str, string expected, StringComparison stringComparison = StringComparison.CurrentCultureIgnoreCase, string message = "")
{
Assert.IsTrue(str.StartsWith(expected, stringComparison),
String.Format("The following do not match start of string using string comparison '{0}':\n {1} [Actual]\b {1} [Expected]", stringComparison.ToString(), str, expected));
}
示例6: ShouldEqual
public static void ShouldEqual(this string str, string expected, StringComparison stringComparison, string message = "")
{
if(!String.Equals(str, expected, stringComparison))
Assert.Fail("The following do not match using string comparison '{0}':\n {1} [Actual]\b {1} [Expected]", stringComparison.ToString(), str, expected);
}
示例7: Str
public static void Str(this ExtensionMethodInvokerTest self, StringComparison cmp)
{
self.Text.Append(cmp.ToString());
}