C# toString

gilles81 Messages postés 72 Statut Membre -  
Wardog Messages postés 398 Statut Membre -
Bonjour,
je voudrais obtenir ce qui est ci-dessous a partir d'une méthode String:


Buch
----------------------
Titel : Vom Winde verweht
Verkaufszahlen : 200000
Preis pro Stück ($) : 6,99
Beteiligungssatz : 5,00 %


voici ma méthode :

public override string ToString()
{
return String.Format("{0}{1}{2}{3}{4}", title, sale, price, participation,pages);
}

comment ajouter par exemple "Betieligungssatz:" et "%"

merci

1 réponse

Wardog Messages postés 398 Statut Membre 159
 
Bonsoir,

peut-être un truc du genre:

public override string ToString()
{
return String.Format("{0}\n----------------------\nTitel : {1}\nVerkaufszahlen : {2}\nPreis pro Stück ($) : {3}\nBeteiligungssatz : {4} %", title, sale, price, participation,pages);
}

1