Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace TP1
  8. {
  9. public class Liste_Commandes
  10. {
  11. public List<Commande> listeCde {get; set; }
  12. public Liste_Commandes()
  13. {
  14. listeCde = new List<Commande>();
  15. }
  16. public void ajouter_Cde(Commande c)
  17. {
  18. listeCde.Add(c);
  19. }
  20. public void supprimer_Cde(Commande c)
  21. {
  22. listeCde.Remove(c);
  23. }
  24. public int rechercher_cde(int numC)
  25. {
  26. int i = 0;
  27. bool test = false;
  28. while(test==false && i<listeCde.Count)
  29. {
  30. if (numC == listeCde[i].numero_com )
  31. {
  32. test = true;
  33. }
  34. else
  35. {
  36. i++;
  37. }
  38.  
  39. }
  40. if (test == true)
  41. {
  42. return i;
  43. }
  44. else
  45. return -1;
  46. }
  47. }
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement