public static void Main (string[] args)
Console.WriteLine(GetName(foo));
Console.WriteLine(GetName(bar));
public static string GetName(object value)
{} type when type.GetType().GetProperty("Name") != null => (string)type.GetType().GetProperty("Name").GetValue(type),
public string Name { get; set; }