-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWebForm1.aspx.cs
32 lines (29 loc) · 1.03 KB
/
WebForm1.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using System.ComponentModel;
namespace Sitecore.SharedSource
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
//public static DataTable ToDataTable<T>(this IList<T> list)
//{
// PropertyDescriptorCollection props = TypeDescriptor.GetProperties(typeof(T));
// DataTable table = new DataTable();
// for (int i = 0; i < props.Count; i++)
// {
// PropertyDescriptor prop = props[i];
// table.Columns.Add(prop.Name, Nullable.GetUnderlyingType(prop.PropertyType) ?? prop.PropertyType);
// }
// object[] values = new object[props.Count];
// foreach (T item in list)
// {
// for (int i = 0; i < values.Length; i++)
// values[i] = props[i].GetValue(item) ?? DBNull.Value;
// table.Rows.Add(values);
// }
// return table;
//}
}
}