Languages
[Edit]
EN

C# / .NET - convert char to string

0 points
Created by:
Veer-Ahmad
487

In this article, we would like to show you how to convert char to string in C#.

Quick solution:

char character = 'x';
var result = character.ToString();

 

Practical example

In this section, we present full example of using the Char.ToString() method to convert a character to a string.

using System;

public class TestClass
{
    public static void Main()
    {
        char character = 'x';
        var result = character.ToString();

        Console.WriteLine(result.GetType());
    }
}

Output:

System.String

References

  1. Char.ToString Method (System) | Microsoft Docs
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join