- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- 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
Advertisements