How to convert List<KeyValuePair<string, decimal>> list = new List<KeyValuePair<string, decimal>>( ); to DataTable?

I have a list

List<> list = new List<>();

I want to convert this to a data table.How it is possible?


The following is the method through which you can convert any list object to datatable..

 public DataTable ConvertToDataTable<T>(IList<T> data)
        PropertyDescriptorCollection properties =
        DataTable table = new DataTable();
        foreach (PropertyDescriptor prop in properties)
            table.Columns.Add(prop.Name, Nullable.GetUnderlyingType(prop.PropertyType) ?? prop.PropertyType);
        foreach (T item in data)
            DataRow row = table.NewRow();
            foreach (PropertyDescriptor prop in properties)
                row[prop.Name] = prop.GetValue(item) ?? DBNull.Value;
        return table;


Need Your Help

question about reading data from urls on iphone/ipad

iphone objective-c url ipad ios

I have an app which uses a UIWebView to load a webpage, I then parse the links (triggered by a call of webViewDidFinishLoad) from that webpage and load all these html files using NSString

show more than 20 invoices in invoice report in Microsoft Dynamics crm

dynamics-crm-2011 dynamics-crm dynamics-crm-2013 microsoft-dynamics

Out of box invoice report shows only maximum of 20 invoices.Is there a way to show more invoices?Unable to do even using SSRS. It's critical for our customer. Thanks in advance.