Convert.ToByte() মেথড মানকে ৮-বিট আনসাইনড ইন্টিজার (byte, ০-২৫৫) এ কনভার্ট করে।
উদাহরণ
using System;
public class Demo
{
public static void Main()
{
char[] charVal = { 'p', 'q', 'r', 's' };
foreach (char c in charVal)
{
byte byteVal = Convert.ToByte(c);
Console.WriteLine("{0} is converted to = {1}", c, byteVal);
}
}
}
আউটপুট
p is converted to = 112 q is converted to = 113 r is converted to = 114 s is converted to = 115
ASCII টেবিল অনুযায়ী 'p'=112, 'q'=113, 'r'=114, 's'=115।