NServiceBus.Guard.AgainstNegative C# (CSharp) Method

AgainstNegative() public static method

public static AgainstNegative ( [ argumentName, System.TimeSpan value ) : void
argumentName [
value System.TimeSpan
return void
        public static void AgainstNegative([InvokerParameterName] string argumentName, TimeSpan value)
        {
            if (value < TimeSpan.Zero)
            {
                throw new ArgumentOutOfRangeException(argumentName);
            }
        }
    }

Same methods

Guard::AgainstNegative ( [ argumentName, int value ) : void

Usage Example

        /// <summary>
        /// Number of retries when operation is throttled.
        /// <remarks>Default is 5 attempts.</remarks>
        /// </summary>
        public AzureServiceBusMessageSenderSettings RetryAttemptsOnThrottle(int count)
        {
            Guard.AgainstNegative(nameof(count), count);
            settings.Set(WellKnownConfigurationKeys.Connectivity.MessageSenders.RetryAttemptsOnThrottle, count);

            return(this);
        }
All Usage Examples Of NServiceBus.Guard::AgainstNegative