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
Starting texture on device context.
TexturedRenderObject is rendering BarkingHorse
Ending texture on device context.
ImageRenderObject 'DivingWeasel' is rendering an image of DivingWeasel.png
ImageRenderObject 'CullingBird' is rendering an image of CullingBird.png
TexturedRenderObject is rendering BarkingHorse
Ending texture on device context.
ImageRenderObject 'DivingWeasel' is rendering an image of DivingWeasel.png
ImageRenderObject 'CullingBird' is rendering an image of CullingBird.png