NServiceBus.Guard.AgainstNegativeAndZero C# (CSharp) Method

AgainstNegativeAndZero() public static method

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

Same methods

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

Usage Example

        /// <summary>
        /// Maximum message size allowed for sending.
        /// <remarks>Default is 256KB.</remarks>
        /// </summary>
        public AzureServiceBusMessageSenderSettings MaximuMessageSizeInKilobytes(int sizeInKilobytes)
        {
            Guard.AgainstNegativeAndZero(nameof(sizeInKilobytes), sizeInKilobytes);
            settings.Set(WellKnownConfigurationKeys.Connectivity.MessageSenders.MaximumMessageSizeInKilobytes, sizeInKilobytes);

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