|
|
|
@ -8,8 +8,14 @@ namespace Perspex |
|
|
|
{ |
|
|
|
internal static class Contract |
|
|
|
{ |
|
|
|
public static void Requires<TException>(bool condition) where TException : Exception |
|
|
|
public static void Requires<TException>(bool condition) where TException : Exception, new() |
|
|
|
{ |
|
|
|
#if DEBUG
|
|
|
|
if (!condition) |
|
|
|
{ |
|
|
|
throw new TException(); |
|
|
|
} |
|
|
|
#endif
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|