System.Contract.RequiresInInclusiveRange C# (CSharp) Method

RequiresInInclusiveRange() public static method

public static RequiresInInclusiveRange ( int start, int length ) : void
start int
length int
return void
        public static void RequiresInInclusiveRange(int start, int length)
        {
            if (!(start >= 0 && start <= length)) {
                throw new ArgumentOutOfRangeException();
            }
        }

Same methods

Contract::RequiresInInclusiveRange ( int start, int end, int length ) : void

Usage Example

        public static void Write <[Primitive] T>(this Span <byte> slice, T value)
            where T : struct
        {
            Contract.RequiresInInclusiveRange(Unsafe.SizeOf <T>(), (uint)slice.Length);
            Span <T> castedSlice = slice.Cast <byte, T>();

            castedSlice[0] = value;
        }
All Usage Examples Of System.Contract::RequiresInInclusiveRange