Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to convert a list of characters into a string in C#?
Firstly, set the characters.
char[] arr = new char[5]; arr[0] = 'Y'; arr[1] = 'E'; arr[2] = 'S';
Now, convert them into string.
string res = new string(arr);
The following is the complete code to convert a list of characters into a string −
Example
using System;
class Program {
static void Main() {
char[] arr = new char[5];
arr[0] = 'Y';
arr[1] = 'E';
arr[2] = 'S';
// converting to string
string res = new string(arr);
Console.WriteLine(res);
}
}
Output
YES
Advertisements