2016-04-05 14 views
0
class Persoana 
    { 
     public string name; 
     public Persoana[] children; 

     Persoana(string nume, Persoana[] copii) { 
      this.name = name; 
      this.children = children; 
     } 

     public override string toString() { //what is wrong in this function? 
      string temp = null; 
      for (int i = 0; i < this.children.Length; i++) 
       temp = temp + this.children[i].name; //I don' know how to do it with a string.join in this case 
      return string.Format("Parent name: {0} Number of children: {1} Children: {2}", name, children.Length); 
     } 
    } 

Antwort

1

Ich denke, Sie brauchen Typ 'String', nicht 'String'.

+0

Ja, das habe ich später bemerkt. Danke! –

+0

vielleicht wirst du meine Antwort dann akzeptieren? ;) –

Verwandte Themen