System.Contract.Assert C# (CSharp) Method

Assert() public static method

public static Assert ( bool condition ) : void
condition bool
return void
        public static void Assert(bool condition)
        {
            if (!condition) {
                Abandon();
            }
        }

Usage Example

Esempio n. 1
0
 ////////////////////////////////////////////////////////////////////////////
 //
 // Format the positive integer value to a string and perfix with assigned
 // length of leading zero.
 //
 // Parameters:
 //  value: The value to format
 //  len: The maximum length for leading zero.
 //  If the digits of the value is greater than len, no leading zero is added.
 //
 // Notes:
 //  The function can format to Int32.MaxValue.
 //
 ////////////////////////////////////////////////////////////////////////////
 internal static void FormatDigits(StringBuilder outputBuffer, int value, int len)
 {
     Contract.Assert(value >= 0, "DateTimeFormat.FormatDigits(): value >= 0");
     FormatDigits(outputBuffer, value, len, false);
 }
All Usage Examples Of System.Contract::Assert