Apq.Cfg.Validation.Rules.RangeRule.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Class RangeRule | Apq.Cfg API </title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <meta name="title" content="Class RangeRule | Apq.Cfg API ">
  8. <meta name="description" content="范围验证规则工厂">
  9. <link rel="icon" href="../favicon.svg">
  10. <link rel="stylesheet" href="../public/docfx.min.css">
  11. <link rel="stylesheet" href="../public/main.css">
  12. <meta name="docfx:navrel" content="../toc.html">
  13. <meta name="docfx:tocrel" content="toc.html">
  14. <meta name="docfx:rel" content="../">
  15. <meta name="loc:inThisArticle" content="In this article">
  16. <meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
  17. <meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
  18. <meta name="loc:tocFilter" content="Filter by title">
  19. <meta name="loc:nextArticle" content="Next">
  20. <meta name="loc:prevArticle" content="Previous">
  21. <meta name="loc:themeLight" content="Light">
  22. <meta name="loc:themeDark" content="Dark">
  23. <meta name="loc:themeAuto" content="Auto">
  24. <meta name="loc:changeTheme" content="Change theme">
  25. <meta name="loc:copy" content="Copy">
  26. <meta name="loc:downloadPdf" content="Download PDF">
  27. <script type="module" src="./../public/docfx.min.js"></script>
  28. <script>
  29. const theme = localStorage.getItem('theme') || 'auto'
  30. document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
  31. </script>
  32. </head>
  33. <body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
  34. <header class="bg-body border-bottom">
  35. <nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
  36. <div class="container-xxl flex-nowrap">
  37. <a class="navbar-brand" href="../index.html">
  38. <img id="logo" class="svg" src="../images/logo-small.svg" alt="Apq.Cfg">
  39. Apq.Cfg
  40. </a>
  41. <button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
  42. <i class="bi bi-three-dots"></i>
  43. </button>
  44. <div class="collapse navbar-collapse" id="navpanel">
  45. <div id="navbar">
  46. <form class="search" role="search" id="search">
  47. <i class="bi bi-search"></i>
  48. <input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
  49. </form>
  50. </div>
  51. </div>
  52. </div>
  53. </nav>
  54. </header>
  55. <main class="container-xxl">
  56. <div class="toc-offcanvas">
  57. <div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
  58. <div class="offcanvas-header">
  59. <h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
  60. <button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
  61. </div>
  62. <div class="offcanvas-body">
  63. <nav class="toc" id="toc"></nav>
  64. </div>
  65. </div>
  66. </div>
  67. <div class="content">
  68. <div class="actionbar">
  69. <button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
  70. <i class="bi bi-list"></i>
  71. </button>
  72. <nav id="breadcrumb"></nav>
  73. </div>
  74. <article data-uid="Apq.Cfg.Validation.Rules.RangeRule">
  75. <h1 id="Apq_Cfg_Validation_Rules_RangeRule" data-uid="Apq.Cfg.Validation.Rules.RangeRule" class="text-break">
  76. Class RangeRule
  77. </h1>
  78. <div class="facts text-secondary">
  79. <dl><dt>Namespace</dt><dd><a class="xref" href="Apq.html">Apq</a>.<a class="xref" href="Apq.Cfg.html">Cfg</a>.<a class="xref" href="Apq.Cfg.Validation.html">Validation</a>.<a class="xref" href="Apq.Cfg.Validation.Rules.html">Rules</a></dd></dl>
  80. <dl><dt>Assembly</dt><dd>Apq.Cfg.dll</dd></dl>
  81. </div>
  82. <div class="markdown summary"><p>范围验证规则工厂</p>
  83. </div>
  84. <div class="markdown conceptual"></div>
  85. <div class="codewrapper">
  86. <pre><code class="lang-csharp hljs">public static class RangeRule</code></pre>
  87. </div>
  88. <dl class="typelist inheritance">
  89. <dt>Inheritance</dt>
  90. <dd>
  91. <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
  92. <div><span class="xref">RangeRule</span></div>
  93. </dd>
  94. </dl>
  95. <dl class="typelist inheritedMembers">
  96. <dt>Inherited Members</dt>
  97. <dd>
  98. <div>
  99. <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object)</a>
  100. </div>
  101. <div>
  102. <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a>
  103. </div>
  104. <div>
  105. <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a>
  106. </div>
  107. <div>
  108. <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>
  109. </div>
  110. <div>
  111. <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>
  112. </div>
  113. <div>
  114. <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a>
  115. </div>
  116. <div>
  117. <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>
  118. </div>
  119. </dd></dl>
  120. <h2 class="section" id="methods">Methods
  121. </h2>
  122. <a id="Apq_Cfg_Validation_Rules_RangeRule_ForDateTime_" data-uid="Apq.Cfg.Validation.Rules.RangeRule.ForDateTime*"></a>
  123. <h3 id="Apq_Cfg_Validation_Rules_RangeRule_ForDateTime_System_String_System_DateTime_System_DateTime_System_String_" data-uid="Apq.Cfg.Validation.Rules.RangeRule.ForDateTime(System.String,System.DateTime,System.DateTime,System.String)">
  124. ForDateTime(string, DateTime, DateTime, string?)
  125. </h3>
  126. <div class="markdown level1 summary"><p>创建日期时间范围验证规则</p>
  127. </div>
  128. <div class="markdown level1 conceptual"></div>
  129. <div class="codewrapper">
  130. <pre><code class="lang-csharp hljs">public static RangeRule&lt;DateTime&gt; ForDateTime(string key, DateTime min, DateTime max, string? errorMessage = null)</code></pre>
  131. </div>
  132. <h4 class="section">Parameters</h4>
  133. <dl class="parameters">
  134. <dt><code>key</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
  135. <dd></dd>
  136. <dt><code>min</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.datetime">DateTime</a></dt>
  137. <dd></dd>
  138. <dt><code>max</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.datetime">DateTime</a></dt>
  139. <dd></dd>
  140. <dt><code>errorMessage</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
  141. <dd></dd>
  142. </dl>
  143. <h4 class="section">Returns</h4>
  144. <dl class="parameters">
  145. <dt><a class="xref" href="Apq.Cfg.Validation.Rules.RangeRule-1.html">RangeRule</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.datetime">DateTime</a>&gt;</dt>
  146. <dd></dd>
  147. </dl>
  148. <a id="Apq_Cfg_Validation_Rules_RangeRule_ForDecimal_" data-uid="Apq.Cfg.Validation.Rules.RangeRule.ForDecimal*"></a>
  149. <h3 id="Apq_Cfg_Validation_Rules_RangeRule_ForDecimal_System_String_System_Decimal_System_Decimal_System_String_" data-uid="Apq.Cfg.Validation.Rules.RangeRule.ForDecimal(System.String,System.Decimal,System.Decimal,System.String)">
  150. ForDecimal(string, decimal, decimal, string?)
  151. </h3>
  152. <div class="markdown level1 summary"><p>创建十进制数范围验证规则</p>
  153. </div>
  154. <div class="markdown level1 conceptual"></div>
  155. <div class="codewrapper">
  156. <pre><code class="lang-csharp hljs">public static RangeRule&lt;decimal&gt; ForDecimal(string key, decimal min, decimal max, string? errorMessage = null)</code></pre>
  157. </div>
  158. <h4 class="section">Parameters</h4>
  159. <dl class="parameters">
  160. <dt><code>key</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
  161. <dd></dd>
  162. <dt><code>min</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.decimal">decimal</a></dt>
  163. <dd></dd>
  164. <dt><code>max</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.decimal">decimal</a></dt>
  165. <dd></dd>
  166. <dt><code>errorMessage</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
  167. <dd></dd>
  168. </dl>
  169. <h4 class="section">Returns</h4>
  170. <dl class="parameters">
  171. <dt><a class="xref" href="Apq.Cfg.Validation.Rules.RangeRule-1.html">RangeRule</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.decimal">decimal</a>&gt;</dt>
  172. <dd></dd>
  173. </dl>
  174. <a id="Apq_Cfg_Validation_Rules_RangeRule_ForDouble_" data-uid="Apq.Cfg.Validation.Rules.RangeRule.ForDouble*"></a>
  175. <h3 id="Apq_Cfg_Validation_Rules_RangeRule_ForDouble_System_String_System_Double_System_Double_System_String_" data-uid="Apq.Cfg.Validation.Rules.RangeRule.ForDouble(System.String,System.Double,System.Double,System.String)">
  176. ForDouble(string, double, double, string?)
  177. </h3>
  178. <div class="markdown level1 summary"><p>创建双精度浮点数范围验证规则</p>
  179. </div>
  180. <div class="markdown level1 conceptual"></div>
  181. <div class="codewrapper">
  182. <pre><code class="lang-csharp hljs">public static RangeRule&lt;double&gt; ForDouble(string key, double min, double max, string? errorMessage = null)</code></pre>
  183. </div>
  184. <h4 class="section">Parameters</h4>
  185. <dl class="parameters">
  186. <dt><code>key</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
  187. <dd></dd>
  188. <dt><code>min</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
  189. <dd></dd>
  190. <dt><code>max</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
  191. <dd></dd>
  192. <dt><code>errorMessage</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
  193. <dd></dd>
  194. </dl>
  195. <h4 class="section">Returns</h4>
  196. <dl class="parameters">
  197. <dt><a class="xref" href="Apq.Cfg.Validation.Rules.RangeRule-1.html">RangeRule</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>&gt;</dt>
  198. <dd></dd>
  199. </dl>
  200. <a id="Apq_Cfg_Validation_Rules_RangeRule_ForInt_" data-uid="Apq.Cfg.Validation.Rules.RangeRule.ForInt*"></a>
  201. <h3 id="Apq_Cfg_Validation_Rules_RangeRule_ForInt_System_String_System_Int32_System_Int32_System_String_" data-uid="Apq.Cfg.Validation.Rules.RangeRule.ForInt(System.String,System.Int32,System.Int32,System.String)">
  202. ForInt(string, int, int, string?)
  203. </h3>
  204. <div class="markdown level1 summary"><p>创建整数范围验证规则</p>
  205. </div>
  206. <div class="markdown level1 conceptual"></div>
  207. <div class="codewrapper">
  208. <pre><code class="lang-csharp hljs">public static RangeRule&lt;int&gt; ForInt(string key, int min, int max, string? errorMessage = null)</code></pre>
  209. </div>
  210. <h4 class="section">Parameters</h4>
  211. <dl class="parameters">
  212. <dt><code>key</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
  213. <dd></dd>
  214. <dt><code>min</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
  215. <dd></dd>
  216. <dt><code>max</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
  217. <dd></dd>
  218. <dt><code>errorMessage</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
  219. <dd></dd>
  220. </dl>
  221. <h4 class="section">Returns</h4>
  222. <dl class="parameters">
  223. <dt><a class="xref" href="Apq.Cfg.Validation.Rules.RangeRule-1.html">RangeRule</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a>&gt;</dt>
  224. <dd></dd>
  225. </dl>
  226. <a id="Apq_Cfg_Validation_Rules_RangeRule_ForLong_" data-uid="Apq.Cfg.Validation.Rules.RangeRule.ForLong*"></a>
  227. <h3 id="Apq_Cfg_Validation_Rules_RangeRule_ForLong_System_String_System_Int64_System_Int64_System_String_" data-uid="Apq.Cfg.Validation.Rules.RangeRule.ForLong(System.String,System.Int64,System.Int64,System.String)">
  228. ForLong(string, long, long, string?)
  229. </h3>
  230. <div class="markdown level1 summary"><p>创建长整数范围验证规则</p>
  231. </div>
  232. <div class="markdown level1 conceptual"></div>
  233. <div class="codewrapper">
  234. <pre><code class="lang-csharp hljs">public static RangeRule&lt;long&gt; ForLong(string key, long min, long max, string? errorMessage = null)</code></pre>
  235. </div>
  236. <h4 class="section">Parameters</h4>
  237. <dl class="parameters">
  238. <dt><code>key</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
  239. <dd></dd>
  240. <dt><code>min</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int64">long</a></dt>
  241. <dd></dd>
  242. <dt><code>max</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int64">long</a></dt>
  243. <dd></dd>
  244. <dt><code>errorMessage</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
  245. <dd></dd>
  246. </dl>
  247. <h4 class="section">Returns</h4>
  248. <dl class="parameters">
  249. <dt><a class="xref" href="Apq.Cfg.Validation.Rules.RangeRule-1.html">RangeRule</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int64">long</a>&gt;</dt>
  250. <dd></dd>
  251. </dl>
  252. </article>
  253. </div>
  254. <div class="affix">
  255. <nav id="affix"></nav>
  256. </div>
  257. </main>
  258. <div class="container-xxl search-results" id="search-results"></div>
  259. <footer class="border-top text-secondary">
  260. <div class="container-xxl">
  261. <div class="flex-fill">
  262. Apq.Cfg - .NET 统一配置组件库 (基于 .NET 10.0,兼容 .NET 8.0)
  263. </div>
  264. </div>
  265. </footer>
  266. </body>
  267. </html>