public static void Main()
var properties = Service.GetProperties(car);
var atributoSelecionado = properties.Where(p => p.Name == atributo).FirstOrDefault().GetValue(car,null);
Console.WriteLine(atributoSelecionado);
foreach (var p in properties)
var value = p.GetValue(car, null);
public int CarroId { get; set; }
public string Modelo { get; set; }
public string Marca { get; set; }
public static class Service
public static PropertyInfo[] GetProperties(object obj)
return obj.GetType().GetProperties();