find the selected feature in layer

Discussion created by rehu on Oct 13, 2010
Latest reply on Oct 14, 2010 by thaviti
i am selecting the feature using select feature tool in toolbar.
my problem is that i want to know oid of all the selected but the code below is giving me only one oid.
how to get all the ids of selected feature.
thanx in advance

ESRI.ArcGIS.Carto.IFeatureSelection pSelection;
            pSelection = =ESRI.ArcGIS.Carto.IFeatureSelection)axMapControl1.ActiveView.FocusMap.get_Layer(0);
            ITable table = (ITable)pSelection;
            int count= pSelection.SelectionSet.Count;
            int i = table.FindField("filedname");
            String test = table.OIDFieldName.ToString();
            int oid = pSelection.SelectionSet.IDs.Next();
            IRow row = table.GetRow(oid);
            String selectedstate = row.get_Value(i).ToString();