示例#1
0
 /// <summary>
 /// 比较集合中是否含有指定元素
 /// </summary>
 /// <param name="sector"></param>
 /// <returns></returns>
 public bool Contains(MeterThreshold sector)
 {
     foreach (MeterThreshold obj in InnerList)
     {
         if ((obj.StartValue == sector.StartValue) &&
             (obj.EndValue == sector.EndValue))
         {
             return(true);
         }
     }
     return(false);
 }
示例#2
0
        /// <summary>
        ///从集合中删除一个元素
        /// </summary>
        /// <param name="sector"></param>
        /// <returns></returns>
        public virtual bool Remove(MeterThreshold sector)
        {
            bool result = false;

            //循环
            for (int i = 0; i < InnerList.Count; i++)
            {
                //循环中当前元素
                MeterThreshold obj = (MeterThreshold)InnerList[i];

                //元素比较
                if ((obj.StartValue == sector.StartValue) &&
                    (obj.EndValue == sector.EndValue))
                {
                    //移除当前元素
                    InnerList.RemoveAt(i);
                    result = true;
                    break;
                }
            }

            return(result);
        }
示例#3
0
 /// <summary>
 /// 添加一个元素进入集合
 /// </summary>
 /// <param name="sector"></param>
 public virtual void Add(MeterThreshold sector)
 {
     InnerList.Add(sector);
 }