fork download
  1. using System.Collections.Generic;
  2. using static System.Console;
  3. using System;
  4.  
  5. public class Program {
  6. public static void Main() {
  7. MvcHtmlString(new List<Funcionario> { new Funcionario() });
  8. MvcHtmlString(new List<Carro> { new Carro() });
  9. }
  10. public static void MvcHtmlString<T>(List<T> listaObj) {
  11. if (typeof(T) == typeof(Funcionario)) WriteLine("É lista de Funcionários");
  12. else WriteLine("Não é lista de Funcionários");
  13. }
  14. }
  15.  
  16. public class Funcionario{
  17. public long Id {get; set;}
  18. public string Nome {get; set;}
  19. public DateTime DataContrato {get; set;}
  20. }
  21.  
  22. public class Carro{
  23. public long Id {get; set;}
  24. public string Nome {get; set;}
  25. public bool IsUsado {get; set;}
  26. }
  27.  
  28. //https://pt.stackoverflow.com/q/161578/101
Success #stdin #stdout 0.02s 15908KB
stdin
Standard input is empty
stdout
É lista de Funcionários
Não é lista de Funcionários