当前位置: 首页>>代码示例>>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;未经允许,请勿转载。