Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Convert.ToChar Method in C#
The Convert.ToChar method is used to convert a specified value to a Unicode integer.
We have declared an sbyte variable.
sbyte byteVal = 200;
Now, use the Convert.ToChar() method to convert the sbyte value to a Unicode integer.
charVal = Convert.ToChar(b);
Let us see another example.
Example
using System;
public class Demo {
public static void Main() {
sbyte[] byteVal = { 92, 111, 115 };
char charVal;
foreach (sbyte b in byteVal) {
charVal = Convert.ToChar(b);
Console.WriteLine("{0} converted to '{1}'", b, charVal);
}
}
}
Output
92 converted to '\' 111 converted to 'o' 115 converted to 's'
Advertisements
