C# find properties
What is the process to find the properties in c#?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Jul 9, 2012, 6:22 AM
The example also shows how to include static properties and non-public properties in the list:
The output should be:
Posted Jul 9, 2012, 6:11 AM
PropertyInfo[] propertyInfos = typeof(YourClassName).GetProperties();
// writes all the property names
foreach (PropertyInfo propertyInfo in propertyInfos)
{
Console.WriteLine(propertyInfo.Name);
}
Hope this helps you.