Browse Source

Always check contracts

pull/148/head
Nikita Tsukanov 11 years ago
parent
commit
f9e1516c2a
  1. 5
      src/Perspex.Base/Contract.cs

5
src/Perspex.Base/Contract.cs

@ -1,6 +1,8 @@
// Copyright (c) The Perspex Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System.Runtime.CompilerServices;
namespace Perspex
{
using System;
@ -22,14 +24,13 @@ namespace Perspex
/// The exception to throw if <paramref name="condition"/> is false.
/// </typeparam>
/// <param name="condition">The precondition.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Requires<TException>(bool condition) where TException : Exception, new()
{
#if DEBUG
if (!condition)
{
throw new TException();
}
#endif
}
}
}

Loading…
Cancel
Save