51
1
using System;
2
3
public class Program
4
{
5
public static void Main(string[] args)
6
{
7
Console.WriteLine("Convert Basic Value Types to Byte Arrays\nEduardo Isaac Ballesteros Muñoz\n");
8
9
ConvertBasicValueTypesToByteArray();
10
}
11
12
public static void ConvertBasicValueTypesToByteArray()
13
{
14
byte[] b = null;
15
16
//Convert a bool to a byte array and display
17
b = System.BitConverter.GetBytes(true);
18
System.Console.WriteLine(System.BitConverter.ToString(b));
19
20
//Convert a byte array to a bool and display
21
System.Console.WriteLine(System.BitConverter.ToBoolean(b, 0));
22
23
//Convert a bool to a byte array and display
24
b = System.BitConverter.GetBytes(false);
Cached Result
Compilation error (line 10, col 3): The type or namespace name 'Stopwatch' could not be found (are you missing a using directive or an assembly reference?)
Compilation error (line 10, col 23): The name 'Stopwatch' does not exist in the current context
Compilation error (line 11, col 3): The name 'SortowanieBabelkowe' does not exist in the current context
Compilation error (line 10, col 23): The name 'Stopwatch' does not exist in the current context
Compilation error (line 11, col 3): The name 'SortowanieBabelkowe' does not exist in the current context