you write count after return this was not executed by the compiler first
return Request.CreateResponse(HttpStatusCode.OK, data);
int SelectedRows = data.Count();
but when you return how it will calculate count first and
Send it will along with data. other way to send it is:-
same opration as you to calculate data.
data1 _data1 = new data1();
_data1._Data=data;
_data1.SelectedRows = data.Count();
return Request.CreateResponse(HttpStatusCode.OK, _data1 );
you silple murged you data and count holder variable
and used it any where you want.
public class data1
{
public List<typeofclassreturn> _Data{get;set;}
public int SelectedRows{get;set;}
}
i hope this helps you if not please comment on it.