جواب پیدا شد
برای قسمت اول سوال
using System;
using System.Text;
class Program
{
static void Main()
{
// Input string.
const string input = "Dot Net Perls";
// Invoke GetBytes method.
// ... You can store this array as a field!
byte[] array = Encoding.ASCII.GetBytes(input);
// Loop through contents of the array.
foreach (byte element in array)
{
Console.WriteLine("{0} = {1}", element, (char)element);
}
}
}
و برای قسمت دوم
using System;
using System.Text;
class Program
{
static void Main()
{
byte[] array =
{
68,
111,
116,
32,
78,
101,
116,
32,
80,
101,
114,
108,
115
};
string value = ASCIIEncoding.ASCII.GetString(array);
Console.WriteLine(value);
}
}