- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Append to StringBuilder in C# with a new line on the end
The AppendLine() method appends the content and add a new line on the end.
Firstly, set the StringBuilder −
StringBuilder str = new StringBuilder();
Use AppendLine() −
str.AppendLine("Accessories"); str.AppendLine(); str.AppendLine("Electronics");
The following is the complete code −
Example
using System; using System.Text; class Demo { static void Main() { StringBuilder str = new StringBuilder(); str.AppendLine("Accessories"); str.AppendLine(); str.AppendLine("Electronics"); Console.Write(str); } }
Output
Accessories Electronics
- Related Articles
- Append to StringBuilder in C#
- Append values to the end of a masked array in Numpy
- Find the other end point of a line with given one end and mid using C++
- Clear a StringBuilder in C#
- How to create the StringBuilder in C#?
- Find a new line character with JavaScript RegExp.
- How to append new rows to DataFrame using a Template In Python Pandas
- How to find the MaxCapacity of a StringBuilder in C#?
- How to find the Capacity of a StringBuilder in C#
- Access a character in C# StringBuilder
- How to use StringBuilder in C#?
- The line segment joining $A( 6, 3)$ and $B( -1, -4)$ is doubled in length by adding half of $AB$ to each end. Find the coordinates of the new end points.
- Adding new node or value at the end of LinkedList in C#
- Iterating C# StringBuilder in a foreach loop
- How to find the length of the StringBuilder in C#?

Advertisements