fork download
  1. using static System.Console;
  2. using System.Linq;
  3.  
  4. public class Program {
  5. public static void Main() {
  6. WriteLine(Teste("João", "048", "abc"));
  7. WriteLine(Teste("João", "048", "abc", ""));
  8. WriteLine(Teste("", "João", "048", "abc"));
  9. WriteLine(Teste("", null));
  10. WriteLine(Teste2("", null));
  11. WriteLine(Teste2("", null, "João", "048", "abc"));
  12. }
  13. public static bool Teste(params string[] textos) {
  14. foreach (var item in textos) if (!string.IsNullOrWhiteSpace(item)) return true;
  15. return false;
  16. }
  17. public static bool Teste2(params string[] textos) => textos.Any(item => !string.IsNullOrWhiteSpace(item));
  18. }
  19.  
  20. //https://pt.stackoverflow.com/q/271330/101
Success #stdin #stdout 0.02s 16836KB
stdin
Standard input is empty
stdout
True
True
True
False
False
True