Saturday, February 28, 2009

Convert Generic List In To DataTable

I saw the Converting the List to Data Table articles..that are really nice things

Both are Good Stuffs

public static DataTable convert2Table(List list)


DataTable table = new DataTable();

if (list.Count > 0)


PropertyInfo[] properties = list[0].GetType().GetProperties();

List<string> columns = new List<string>();

foreach (PropertyInfo pi in properties)





foreach (T item in list)


object[] cells = getValues(columns, item);




return table;


private static object[] getValues(List<string> columns, object instance)


object[] ret = new object[columns.Count];

for (int n = 0; n <>


PropertyInfo pi = instance.GetType().GetProperty(columns[n]);

object value = pi.GetValue(instance, null);

ret[n] = value;


return ret;


mchek great technology for AIRTEL mobile users

You can pay your mobile bills, insurance premiums; buy air tickets and movie tickets from the convenience of your phone.

• Pay your Airtel Postpaid Bills or Top-up your Airtel Pre-paid
Just SMS “PAY AIRTEL ” to 543219

• Pay your insurance premium on your mobile


• mCommerce Services

Book your movie tickets SMS “MOVIE
” to 543219 (only on Airtel)

Book your Bus tickets on RedBus SMS “REDBUS ” to 543219 (only on Airtel)

• You can also pay using mChek on

Why mChek?
mChek is an easy, secure, mobile payment technology that has won the most stringent industry certifications like PCI DSS 1.2 and ISO 27001.
The mChek product was voted the “Most Innovative Mobile Customer Care Solution” by the GSMA (The Global Mobile(GSM) Phone Association)