using System.Collections.Generic;
public static void Main()
var article = new Article
Things = new List<string>
Console.WriteLine(article.ToString());
public int Id { get; set; }
public AppUser User { get; set; }
public DateTime Date { get; set; }
public bool Deleted { get; set; }
public override string ToString()
var sb = new StringBuilder();
foreach (var property in typeof(Article).GetProperties())
if (property.PropertyType.Name == nameof(DateTime))
var d = DateTime.Parse(property.GetValue(this, null).ToString());
sb.AppendLine($"{property.Name}: {d.ToString("dd/MM/yyyy")}");
else if (property.PropertyType.ToString() == nameof(AppUser))
foreach (var prop in property.PropertyType.GetProperties())
sb.AppendLine($"{prop.Name}: {prop.GetValue(User, null).ToString()}");
if (prop.Name == "Things")
var list = (List<string>)prop.GetValue(User, null);
foreach (var item in list)
sb.AppendLine($" {item}");
sb.AppendLine($"{property.Name}: {property.GetValue(this, null).ToString()}");
public int Id { get; set; }
public string Name { get; set; }
public List<string> Things { get; set; }