AnsweredAssumed Answered

How do I use a generic List?

Question asked by reneecammarere on Sep 30, 2013
Latest reply on Sep 30, 2013 by reneecammarere
I've got the following routine . . .
      /// <summary>         /// Gets a list of all geoms in a Feature Class         /// </summary>         /// <param name="FClass">The Feature Class</param>         /// <returns>a List of Geometries</returns>         private List<T> GetGeometries<T>(IFeatureClass FClass)         {             List<T> List_Geometries = new List<T>();              IQueryFilter aQF = new QueryFilter();             aQF.WhereClause = "";             ISelectionSet selectionSet = FClass.Select(aQF, esriSelectionType.esriSelectionTypeIDSet, esriSelectionOption.esriSelectionOptionNormal, null);             IEnumIDs enumId = selectionSet.IDs;             int nFeatures = selectionSet.Count;             enumId.Reset();             int id;             for (int j = 0; j < nFeatures; j++)             {                 id = enumId.Next();                 IGeometry pGeom = FClass.GetFeature(id).Shape;                 List_Geometries.Add((T)pGeom);             }             return List_Geometries;         }


I don't get any diagnostics errors on the above routine.  However I do get an error when I attempt to call this method.  How can I call this method from the following set of code . . .
       private List<IPoint> GetPointsList(IFeatureRepository Bfr)
        {
            IFeatureClass Bfc = Bfr.GetFeatureClassByName("PointFeatureClass");
            List<IPoint> listPoints = GetGeometries(Bfc);
            return listPoints;
        }

By the way, this is not the way to do it, but I'm just trying to give an example of what I'm trying to do.

Thanks,
Renee

Outcomes