Mercurial > pub > ImplabNet
diff Implab/Safe.cs @ 272:9d1cca834b05 v3
preview version of Unity xml configuration
author | cin |
---|---|
date | Thu, 26 Apr 2018 03:14:54 +0300 |
parents | 7d52dc684bbd |
children |
line wrap: on
line diff
--- a/Implab/Safe.cs Wed Apr 25 19:23:35 2018 +0300 +++ b/Implab/Safe.cs Thu Apr 26 03:14:54 2018 +0300 @@ -55,6 +55,13 @@ throw new ArgumentOutOfRangeException(paramName); } + public static object CreateDefaultValue(Type type) { + if (type.IsValueType) + return Activator.CreateInstance(type); + + return null; + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void ArgumentInRange(bool condition, string paramName) { if (!condition)