/ Published in: C#
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
using System; using System.Reflection; class Program { static void Main(string[] args) { { Name = "Rhonda", FaveShow = "Fringe, Lost", FaveMovie = "Star Trek", FaveSong = "Contagious" }; var properties = type.GetProperties(); foreach (PropertyInfo property in properties) { Console.WriteLine("{0} : {1}", property.Name, property.GetValue(person, null)); } Console.Read(); } } public class Person { public string Name { get; set; } public string FaveShow { get; set; } public string FaveMovie { get; set; } public string FaveSong { get; set; } }