Blame view

netcore/src/Modularity/Common/NCC.Common/Extension/BooleanExtensions.cs 744 Bytes
de2bd2f9   “wangming”   项目初始化
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  using NCC.Dependency;
  using System;
  
  namespace NCC.Common.Extension
  {
      /// <summary>
      /// 布尔值<see cref="Boolean"/>类型的扩展辅助操作类
      /// </summary>
      [SuppressSniffer]
      public static class BooleanExtensions
      {
          /// <summary>
          /// 把布尔值转换为小写字符串
          /// </summary>
          public static string ToLower(this bool value)
          {
              return value.ToString().ToLower();
          }
  
          /// <summary>
          /// 如果条件成立,则抛出异常
          /// </summary>
          public static void TrueThrow(this bool flag, Exception exception)
          {
              if (flag)
              {
                  throw exception;
              }
          }
      }
  }