Browse Source

Make our simple Contract class throw an exception.

pull/4/head
grokys 12 years ago
parent
commit
37135d5e06
  1. 8
      Perspex/Contract.cs

8
Perspex/Contract.cs

@ -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
}
}
}

Loading…
Cancel
Save