當前位置: 首頁>>代碼示例>>C#>>正文


C# CultureInfo.NullCheck方法代碼示例

本文整理匯總了C#中System.Globalization.CultureInfo.NullCheck方法的典型用法代碼示例。如果您正苦於以下問題:C# CultureInfo.NullCheck方法的具體用法?C# CultureInfo.NullCheck怎麽用?C# CultureInfo.NullCheck使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Globalization.CultureInfo的用法示例。


在下文中一共展示了CultureInfo.NullCheck方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Singularize

 /// <summary>
 /// Singularizes a word
 /// </summary>
 /// <param name="Word">Word to singularize</param>
 /// <param name="Culture">Culture info used to singularize the word (defaults to current culture)</param>
 /// <returns>The word singularized</returns>
 public static string Singularize(this string Word, CultureInfo Culture = null)
 {
     if (Word.IsNullOrEmpty())
         return "";
     Culture = Culture.NullCheck(CultureInfo.CurrentCulture);
     return PluralizationService.CreateService(Culture).Singularize(Word);
 }
開發者ID:gwilkinson,項目名稱:Craig-s-Utility-Library,代碼行數:13,代碼來源:StringExtensions.cs

示例2: FirstDayOfWeek

 /// <summary>
 /// Returns the first day of a week based on the date sent in
 /// </summary>
 /// <param name="Date">Date to get the first day of the week from</param>
 /// <param name="CultureInfo">The culture to use (defaults to current culture)</param>
 /// <returns>The first day of the week</returns>
 public static DateTime FirstDayOfWeek(this DateTime Date,CultureInfo CultureInfo=null)
 {
     Date.ThrowIfNull("Date");
     return Date.AddDays(CultureInfo.NullCheck(CultureInfo.CurrentCulture).DateTimeFormat.FirstDayOfWeek - Date.DayOfWeek).Date;
 }
開發者ID:gwilkinson,項目名稱:Craig-s-Utility-Library,代碼行數:11,代碼來源:DateTimeExtensions.cs

示例3: LastDayOfWeek

 /// <summary>
 /// Returns the last day of a week based on the date sent in
 /// </summary>
 /// <param name="Date">Date to get the last day of the week from</param>
 /// <param name="CultureInfo">The culture to use (defaults to current culture)</param>
 /// <returns>The last day of the week</returns>
 public static DateTime LastDayOfWeek(this DateTime Date, CultureInfo CultureInfo = null)
 {
     Date.ThrowIfNull("Date");
     return Date.FirstDayOfWeek(CultureInfo.NullCheck(CultureInfo.CurrentCulture)).AddDays(6);
 }
開發者ID:gwilkinson,項目名稱:Craig-s-Utility-Library,代碼行數:11,代碼來源:DateTimeExtensions.cs

示例4: Pluralize

 /// <summary>
 ///     Pluralizes a word
 /// </summary>
 /// <param name="word">Word to pluralize</param>
 /// <param name="culture">Culture info used to pluralize the word (defaults to current culture)</param>
 /// <returns>The word pluralized</returns>
 public static string Pluralize(this string word, CultureInfo culture = null)
 {
     if (word.IsNullOrEmpty())
         return "";
     culture = culture.NullCheck(CultureInfo.CurrentCulture);
     return PluralizationService.CreateService(culture).Pluralize(word);
 }
開發者ID:OxPatient,項目名稱:Rule-Engine,代碼行數:13,代碼來源:StringExtensions.cs


注:本文中的System.Globalization.CultureInfo.NullCheck方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。