26 Mart 2011 Cumartesi

C# - convert DataTable to ArrayList

I need to output a result list which i have as DataTable from a C# web service. So, i have to convert it to ArrayList before using..
here is a code for conversion:
private ArrayList ConvertDT(ref DataTable dt) {
ArrayList converted = new ArrayList(dt.Rows.Count);

foreach (DataRow row in dt.Rows){

return converted;

// for access

1 yorum:

  1. very nice. Thanks.

    Take a look into this article http://www.etechpulse.com/2012/09/convert-datatable-to-json-in-aspnet.html