fork download
  1. using System;
  2.  
  3. public struct Rec_t {
  4. public int id;
  5. public string name;
  6. }
  7. public struct Globals {
  8. public static Rec_t[] array_A = {
  9. new Rec_t{ id = 1, name = "Alice" },
  10. new Rec_t{ id = 2, name = "Bob" },
  11. new Rec_t{ id = 3, name = "Carol" },
  12. new Rec_t{ id = 4, name = "David" },
  13. new Rec_t{ id = 5, name = "Elic" },
  14. };
  15. public static Rec_t[] array_B = {
  16. new Rec_t{ id = 6, name = "Fredy" },
  17. new Rec_t{ id = 7, name = "George" },
  18. new Rec_t{ id = 8, name = "Henry" },
  19. new Rec_t{ id = 9, name = "Isac" },
  20. };
  21. }
  22. public class Program
  23. {
  24. public static bool test( string[] id_strings, Rec_t[] arr ){
  25. foreach ( var r in arr ){
  26. if ( id_strings[0] == r.id.ToString() ){
  27. return true;
  28. }
  29. }
  30. return false;
  31. }
  32. public static void Main(){
  33. string[] ReadArray = { "7" };
  34. Console.WriteLine( "test: A = {0}", test( ReadArray, Globals.array_A ) );
  35. Console.WriteLine( "test: B = {0}", test( ReadArray, Globals.array_B ) );
  36. }
  37. }
  38.  
Success #stdin #stdout 0.04s 33888KB
stdin
Standard input is empty
stdout
test: A = False
test: B = True