Pages

Showing posts with label linq. Show all posts
Showing posts with label linq. Show all posts

Tuesday, February 01, 2011

C# - Get All Properties From Class Or Type

Have you ever try to get all properties from a Class/Type on the fly? the next snippet demonstrates how to query the class instance and retrieve the properties names and their respective values.

It goes like this...




















This way you have a string returned like "propName1: valueProp1\n" and so on.


Reference: