public string Title {get; set;}
public string Message {get; set;}
public static void Main()
var detail = new Detail(){
Title = "Tytul pierwszy",
Message = "Wiadomosc pierwsza"
var detail2 = new Detail2(){
Message = "Wiadomosc druga"
foreach (var prop in detail.GetType().GetProperties())
string propName = prop.Name;
string propValue = (string)prop.GetValue(detail);
Console.WriteLine(propName + " : " + propValue);
foreach (var prop in detail2.GetType().GetProperties())
string propName = prop.Name;
string propValue = (string)prop.GetValue(detail);
Console.WriteLine(propName + " : " + propValue);