Opc.Ua.NumericRange.EnsureValid C# (CSharp) Method

EnsureValid() public method

Ensures the bounds are valid values for a collection with the specified length.
Returns false if the numeric range is out-of-bounds.
public EnsureValid ( int count ) : bool
count int The value to check is within range
return bool
        public bool EnsureValid(int count)
        {
            // object not indexable.
            if (count == -1)
            {
                return false;
            }

            // check bounds.
            if (m_begin > count || m_end >= count)
            {
                return false;
            }

            // set begin.
            if (m_begin < 0)
            {
                m_begin = 0;
            }

            // set end.
            if (m_end < 0)
            {
                m_end = count;
            }

            return true;
        }
        #endregion

Same methods

NumericRange::EnsureValid ( object value ) : bool