How To Extract Property Names From Custom Class In C#
I am making function for exporting table to .csv file.
I have List where T is custom class.
I need property names of T for columns in .csv file.
How can I extract them to other List ?
You can use reflection:
var propertyNames = typeof(T).GetProperties() .Select(p => p.Name));
- → How to Fire Resize event after all images resize
- → URL routing requires /Home/Page?page=1 instead of /Home/Page/1
- → Getting right encoding from HTTPContext
- → How to create a site map using DNN and C#
- → I want integrate shopify into my mvc 4 c# application
- → Bootstrap Nav Collapse via Data Attributes Not Working
- → Shopify api updating variants returned error
- → ASP.NET C# SEO for each product on detail page on my ECOMMERCE site
- → SEO Meta Tags From Behind Code - C#
- → How to implement search with two terms for a collection?