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


C# StringComparison.GetComparer方法代码示例

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


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

示例1: ShouldNotStartWith

 public static void ShouldNotStartWith(this string actual, string begining, StringComparison comparisonType = StringComparison.CurrentCulture)
 {
     if (actual.Length < begining.Length) {
         return;
     }
     string temp = actual.Substring(0, begining.Length);
     Assert.NotEqual(begining, temp, comparisonType.GetComparer());
 }
开发者ID:EddieGarmon,项目名称:XunitShould,代码行数:8,代码来源:AssertString.cs

示例2: ShouldEndWith

 /// <summary>
 ///     Verifies that a string ends with a given sub-string, using the given comparison type.
 /// </summary>
 /// <param name="actual">The actual.</param>
 /// <param name="ending">The expected end.</param>
 /// <param name="stringComparison">The string comparison.</param>
 /// <remarks></remarks>
 public static void ShouldEndWith(this string actual, string ending, StringComparison stringComparison = StringComparison.CurrentCulture)
 {
     if (actual.Length < ending.Length) {
         throw new EqualException(ending, actual);
     }
     string temp = actual.Substring(actual.Length - ending.Length);
     Assert.Equal(ending, temp, stringComparison.GetComparer());
 }
开发者ID:EddieGarmon,项目名称:XunitShould,代码行数:15,代码来源:AssertString.cs

示例3: ShouldEqual

 /// <summary>
 /// Verifies that a string equals a given string, using the given comparison type.
 /// </summary>
 /// <param name="actual">The actual.</param>
 /// <param name="expected">The expected.</param>
 /// <param name="comparisonType">Type of the comparison.</param>
 /// <remarks></remarks>
 public static void ShouldEqual(this string actual,
     string expected,
     StringComparison comparisonType = StringComparison.CurrentCulture)
 {
     Assert.Equal(expected, actual, comparisonType.GetComparer());
 }
开发者ID:ryansroberts,项目名称:jsonot,代码行数:13,代码来源:StringExtensions.cs

示例4: ShouldStartWith

 /// <summary>
 /// Verifies that a string starts with a given sub-string, using the given comparison type.
 /// </summary>
 /// <param name="actual">The actual.</param>
 /// <param name="begining">The expected start.</param>
 /// <param name="comparisonType">The string comparison.</param>
 /// <remarks></remarks>
 public static void ShouldStartWith(this string actual,
     string begining,
     StringComparison comparisonType = StringComparison.CurrentCulture)
 {
     if (actual.Length < begining.Length)
     {
         throw new EqualException(begining, actual);
     }
     string temp = actual.Substring(0, begining.Length);
     Assert.Equal(begining, temp, comparisonType.GetComparer());
 }
开发者ID:ryansroberts,项目名称:jsonot,代码行数:18,代码来源:StringExtensions.cs


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