I'm doing a spatial query to retrieve the number of points that are contained within a selected polygon. Using that selection set I need to run statistics on a number of fields to return the mean values. How do I convert that selectionset returned from layer.Select(SpatialQuery) to a featureclass so I can then run the CalculateStatistics function?
There is no direct way to do this. The best solution at this point is to create a temporary table from your selection using geoprocessing tools and use that to run Table.CalculateStatistics().
While there is no direct way to call CalculateStatistics on a Selection object, you might be able to do what you want for this particular instance.
Instead of calling Layer.Select(yourSpatialQuery), you can get the underlying Table from the layer (e.g., BasicFeatureLayer.GetTable()). Then you could call Table.CalculateStatistics() on that underlying table, setting TableStatisticsDescription.QueryFilter equal to yourSpatialQuery.