Type.GetProperties()
You can use Type.GetProperties() to Obtain an Object's Public Properties.
After calling GetType(), you iterate over each System.Reflection.
PropertyInfo instance returned from Type.GetProperties() and display
the property names.
Example
class
Program
{
static void Main(string[]
args)
{
DateTime dateTime =
new DateTime();
Type type =
dateTime.GetType();
foreach (System.Reflection.PropertyInfo
property in type.GetProperties())
{
Console.WriteLine(property.Name);
}
Console.ReadLine();
}
}
Above code returns :
Date
Day
DayOfWeek
DayOfYear
Hour
Kind
Millisecond
Minute
Month
Now
UtcNow
Second
Ticks
TimeOfDay
Today
Year
In above program I print all the properties of DateTime.