C# toString

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
Configuration: Windows Vista
Firefox 3.0.4

1 réponse

  • Votes
  • Date
  • Date décroissante
  1. 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);
    }