Beispiel #1
0
        //获取对象在某个列表中的位置
        public static int Pos(object go, object list)
        {
            if (go == null)
            {
                throw new NullReferenceException();
            }
            if (!(go is GeneralObject && list is BaseObjectList))
            {
                throw new Exception("Pos函数只能用于获取GeneralObject在BasicObjectList中的位置");
            }
            GeneralObject  ngo   = (GeneralObject)go;
            BaseObjectList nlist = (BaseObjectList)list;
            int            ret   = nlist.IndexOf(go);

            return(ret);
        }
Beispiel #2
0
 public int IndexOf(BaseObjectList list)
 {
     return list.IndexOf(this);
 }