codeAbsoluteAbsolute
codeAbsoluteAbsolute

Reputation: 19

New line with string interpolation

I try to get a new line between three properties. But I don't get a new line between the properties

Of course I googled it. But I tried with Environmen.newLine and with "\n". But non of this works

 $"Email: {teacher.EmailAddress}{Environment.NewLine} " +
                    $" Telefoonnummer: {teacher.PhoneNumber}  {Environment.NewLine}" +
                    $" Toelichting: {teacher.Explanation}" );

Upvotes: 0

Views: 2043

Answers (1)

meziantou
meziantou

Reputation: 21337

You can use $@ to use verbatim strings with interpolation (new lines are preserved)

$@"Email: {teacherCorrectionRequestDto.EmailAddress}
Telefoonnummer: {teacherCorrectionRequestDto.PhoneNumber}
Toelichting: {teacherCorrectionRequestDto.Explanation}"

Upvotes: 3

Related Questions