var shipmentColumnNames = new List<string>();
var shipmentColumnNames = new List<string>();
var shipmentPropNames = new List<string>();
var props = typeof(TestClass).GetProperties().ToList();
props.ForEach((p) => {
if (p.IsDefined(typeof(ExcelColumnNameAttribute), false))
{
ExcelColumnNameAttribute x = (ExcelColumnNameAttribute)p.GetCustomAttribute(typeof(ExcelColumnNameAttribute));
shipmentColumnNames.Add(x?.ColumnName ?? p.Name);
shipmentPropNames.Add(p.Name);
}
else
{
shipmentColumnNames.Add(p.Name);
shipmentPropNames.Add(p.Name);
}
});
[AttributeUsage(AttributeTargets.Property)]
public class ExcelColumnNameAttribute:Attribute
{
public string ColumnName { get; set; }
}