Mercurial > pub > ImplabNet
diff Implab/Safe.cs @ 251:7c7e9ad6fe4a v3
Prerelease version of RunnableComponent
Added draft messaging interfaces
Added more more helpers to Xml/SerializationHelpers
author | cin |
---|---|
date | Sun, 11 Feb 2018 00:49:51 +0300 |
parents | 5cb4826c2c2a |
children | 7d52dc684bbd |
line wrap: on
line diff
--- a/Implab/Safe.cs Thu Feb 01 02:43:35 2018 +0300 +++ b/Implab/Safe.cs Sun Feb 11 00:49:51 2018 +0300 @@ -6,6 +6,7 @@ using System.Diagnostics; using System.Collections; using System.Runtime.CompilerServices; +using System.Threading.Tasks; #if NET_4_5 using System.Threading.Tasks; @@ -48,14 +49,14 @@ } [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static void ArgumentGreaterThan(int value, int min, string paramName) { + internal static void ArgumentGreaterEqThan(int value, int min, string paramName) { if (value < min) throw new ArgumentOutOfRangeException(paramName); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void ArgumentInRange(int value, int min, int max, string paramName) { - if (value < min || value > max) + public static void ArgumentInRange(bool condition, string paramName) { + if (!condition) throw new ArgumentOutOfRangeException(paramName); } @@ -144,6 +145,12 @@ public static void NoWait(IPromise promise) { } + public static void NoWait(Task promise) { + } + + public static void NoWait<T>(Task<T> promise) { + } + [DebuggerStepThrough] public static IPromise<T> Run<T>(Func<IPromise<T>> action) { ArgumentNotNull(action, "action");