private static int IndexOfBoundary(List <PointSet> T, Boundary C) { for (int index = 0; index < T.Count; index++) { Boundary elem = T[index] as Boundary; if (elem != null && C.Equals(elem)) { return(index); } } throw new Exception("Border not found!"); }