示例#1
0
        protected void AddMethod <TInputValue>(ValueCheckExtDelegate <TInputValue> method)
            where TInputValue : struct
        {
            if (method == null)
            {
                throw new ArgumentNullException(nameof(method));
            }

            if (!_AddInCacheDelegate <TInputValue>(_cacheValueCheckExtDelegates, method))
            {
                throw new ArgumentException(string.Empty, nameof(method));
            }
        }
示例#2
0
        public TInputOutputValue GetValue <TInputOutputValue>(TInputOutputValue value, TInputOutputValue minValue, TInputOutputValue maxValue, TInputOutputValue defaultValue, ValueCheckExtDelegate <TInputOutputValue> method)
            where TInputOutputValue : struct
        {
            if (method == null)
            {
                throw new ArgumentNullException(nameof(method));
            }

            return(method.Invoke(value, minValue, maxValue) ? value : defaultValue);
        }
示例#3
0
        public bool IsValidValue <TInputValue>(TInputValue value, TInputValue minValue, TInputValue maxValue, ValueCheckExtDelegate <TInputValue> method)
            where TInputValue : struct
        {
            if (method == null)
            {
                throw new ArgumentNullException(nameof(method));
            }

            return(method.Invoke(value, minValue, maxValue));
        }