comparison 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
comparison
equal deleted inserted replaced
250:9f63dade3a40 251:7c7e9ad6fe4a
4 using System.Text; 4 using System.Text;
5 using System.Text.RegularExpressions; 5 using System.Text.RegularExpressions;
6 using System.Diagnostics; 6 using System.Diagnostics;
7 using System.Collections; 7 using System.Collections;
8 using System.Runtime.CompilerServices; 8 using System.Runtime.CompilerServices;
9 using System.Threading.Tasks;
9 10
10 #if NET_4_5 11 #if NET_4_5
11 using System.Threading.Tasks; 12 using System.Threading.Tasks;
12 #endif 13 #endif
13 14
46 if (value == null) 47 if (value == null)
47 throw new ArgumentNullException(paramName); 48 throw new ArgumentNullException(paramName);
48 } 49 }
49 50
50 [MethodImpl(MethodImplOptions.AggressiveInlining)] 51 [MethodImpl(MethodImplOptions.AggressiveInlining)]
51 internal static void ArgumentGreaterThan(int value, int min, string paramName) { 52 internal static void ArgumentGreaterEqThan(int value, int min, string paramName) {
52 if (value < min) 53 if (value < min)
53 throw new ArgumentOutOfRangeException(paramName); 54 throw new ArgumentOutOfRangeException(paramName);
54 } 55 }
55 56
56 [MethodImpl(MethodImplOptions.AggressiveInlining)] 57 [MethodImpl(MethodImplOptions.AggressiveInlining)]
57 public static void ArgumentInRange(int value, int min, int max, string paramName) { 58 public static void ArgumentInRange(bool condition, string paramName) {
58 if (value < min || value > max) 59 if (!condition)
59 throw new ArgumentOutOfRangeException(paramName); 60 throw new ArgumentOutOfRangeException(paramName);
60 } 61 }
61 62
62 [MethodImpl(MethodImplOptions.AggressiveInlining)] 63 [MethodImpl(MethodImplOptions.AggressiveInlining)]
63 public static void ArgumentOfType(object value, Type type, string paramName) { 64 public static void ArgumentOfType(object value, Type type, string paramName) {
142 } 143 }
143 144
144 public static void NoWait(IPromise promise) { 145 public static void NoWait(IPromise promise) {
145 } 146 }
146 147
148 public static void NoWait(Task promise) {
149 }
150
151 public static void NoWait<T>(Task<T> promise) {
152 }
153
147 [DebuggerStepThrough] 154 [DebuggerStepThrough]
148 public static IPromise<T> Run<T>(Func<IPromise<T>> action) { 155 public static IPromise<T> Run<T>(Func<IPromise<T>> action) {
149 ArgumentNotNull(action, "action"); 156 ArgumentNotNull(action, "action");
150 157
151 try { 158 try {