Exemplo n.º 1
0
        /// <summary>
        /// Check if the object is containing in the collection
        /// </summary>
        /// <param name="sector"></param>
        /// <returns></returns>
        public bool Contains(HTMeterThreshold sector)
        {
            //loop through the inner ArrayList
            foreach (HTMeterThreshold obj in InnerList)
            {
                //compare the values of the objects
                if ((obj.StartValue == sector.StartValue) &&
                    (obj.EndValue == sector.EndValue))
                {
                    //if it matches return true
                    return(true);
                }
            }

            //no match
            return(false);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Remove an object from the collection
        /// </summary>
        /// <param name="sector"></param>
        /// <returns></returns>
        public virtual bool Remove(HTMeterThreshold sector)
        {
            bool result = false;

            //loop through the inner array's indices
            for (int i = 0; i < InnerList.Count; i++)
            {
                //store current index being checked
                HTMeterThreshold obj = (HTMeterThreshold)InnerList[i];

                //compare the values of the objects
                if ((obj.StartValue == sector.StartValue) &&
                    (obj.EndValue == sector.EndValue))
                {
                    //remove item from inner ArrayList at index i
                    InnerList.RemoveAt(i);
                    result = true;
                    break;
                }
            }

            return(result);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Add an object to the collection
 /// </summary>
 /// <param name="sector"></param>
 public virtual void Add(HTMeterThreshold sector)
 {
     InnerList.Add(sector);
 }