Microsoft.JScript.Debug.PreCondition C# (CSharp) Method

PreCondition() private method

private PreCondition ( bool condition ) : void
condition bool
return void
      public static void PreCondition(bool condition){
        if (!condition)
          throw new PreConditionException("PreCondition missed");
      }

Same methods

Debug::PreCondition ( bool condition, String message ) : void

Usage Example

        internal virtual ArrayObject Unshift(Object[] args)
        {
            Debug.PreCondition(args != null && args.Length > 0);
            uint  oldLength = this.len;
            int   numArgs   = args.Length;
            ulong newLength = oldLength + (ulong)numArgs;

            this.SetLength(newLength);
            if (newLength <= this.denseArrayLength)
            {
                for (int i = (int)(oldLength - 1); i >= 0; i--)
                {
                    this.denseArray[i + numArgs] = this.denseArray[i];
                }
                ArrayObject.Copy(args, 0, this.denseArray, 0, args.Length);
            }
            else
            {
                for (long i = oldLength - 1; i >= 0; i--)
                {
                    this.SetValueAtIndex((uint)(i + numArgs), this.GetValueAtIndex((uint)i));
                }
                for (uint i = 0; i < numArgs; i++)
                {
                    this.SetValueAtIndex(i, args[i]);
                }
            }
            return(this);
        }
All Usage Examples Of Microsoft.JScript.Debug::PreCondition