Hi,
I have a class
- public class AppUpdator
- {
- public string ApplicationName { get; set; }
- public Version CurrentVersion { get; set; }
- public Version InstalledVersion { get; set; }
- public DateTime ReleaseDate { get; set; }
- public StringBuilder Description { get; set; }
- public List
filenames = new List() ; - }
- public struct FileNames
- {
- public string FileName { get; set; }
- public string DestinationFolder { get; set; }
- public byte FileSize { get; set; }
- public enum FileOperation
- {
- Copy,
- Unzip,
- Delete,
- Execute
- }
- public FileOperation Operation { get; set; }
- public string DownloadURL { get; set; }
- }
- public DataTable CreateDataTable
(IEnumerable list) - {
- Type type = typeof(T);
- var properties = type.GetProperties();
- DataTable dataTable = new DataTable();
- foreach (PropertyInfo info in properties)
- {
- dataTable.Columns.Add(new DataColumn(info.Name, Nullable.GetUnderlyingType(info.PropertyType) ?? info.PropertyType));
- }
- foreach (T entity in list)
- {
- object[] values = new object[properties.Length];
- for (int i = 0; i < properties.Length; i++)
- {
- values[i] = properties[i].GetValue(entity);
- }
- dataTable.Rows.Add(values);
- }
- return dataTable;
- }
How to include that
Amit GuptaPosted Apr 23, 2017, 3:53 PM
Anoop BansalPosted Apr 24, 2017, 11:27 AM
Rafnas T PPosted Apr 24, 2017, 1:40 AM