當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。