Get Property Names and Values of Class in [C#] using Reflection - Moazam Badane's Blog

To get names and properties for specific type use Type.GetProperties. The method returns an array of ProperyInfo. A property is considered public to reflection if it has at least one accessor that is public. Otherwise, the property is considered private, and you must use BindingFlags.
In my scenario I wanted my class to be formatted as below.

Address 1
   Name:Moazam
   AddressLine1:India
   City:
   State:MH
   Zip:4111111
   Country:IN

Below is an example.

Post a Comment

0 Comments