From reading the documentation, I assumed that this was the way to accomplish that. However, I got an error when I tried to cast an ILayer object to an IFeatureLayer object. This is the snippit of code:
ILayer pLayer = aMap.get_Layer(layercount - 1);
IFeatureLayer pFeatureLayer = (IFeatureLayer)pLayer;
IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
IFeature pFeature = pFeatureClass.CreateFeature();
IGeometry pGeometry = pFeature.Shape;