bouchnina

ToString Theorique 2013

Jun 26th, 2013
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.43 KB | None | 0 0
  1. /* Methode ToString() Theorique 2013
  2. By bouchnina Brahim
  3. 3 point et demi machi sahla ;)
  4. */
  5.  
  6. // Premiere Solution
  7.  
  8. public override string ToString(){
  9.     Personne p;
  10.     list<Personne> liste = new list<Personne>();
  11.     string text=string.Empty;
  12.     p=this.Pere;
  13.     do{
  14.     if(p==null) return text;
  15.     liste.Add(p);
  16.     p=p.Pere;
  17.     }while(p!=null);
  18.     for(int i=0;i<liste.Count;i++){
  19.     text+=(liste[i].NomComplet()+"\n");
  20.     }
  21.     return text;
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment