Created
May 7, 2020 20:40
-
-
Save enisn/68a45da9b5d898e4bc4948d0d2762a8a to your computer and use it in GitHub Desktop.
Challenge #2 - Solution - 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var user = new User { Name = "John", Email = "[email protected]", Surname = "Doe" /* ... */}; | |
var properties = user.GetType().GetProperties(); | |
foreach(var property in properties) | |
{ | |
Console.WriteLine(property.Name + " : " + property.GetValue(user)); | |
} | |
/* | |
OUTPUT for given object | |
Name : John | |
Email : [email protected] | |
Surname : Doe | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment