How to use Buffer.GetByte() to get the bytes of byte array in C#

1 Answer

0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            byte[] arr = new byte[] { 1, 2, 3, 4, 5, 6, 7 };

            for (int i = 0; i < Buffer.ByteLength(arr); i++)
                Console.WriteLine(Buffer.GetByte(arr, i));
        }
    }
}

/*
run:

1
2
3
4
5
6
7

*/

 



answered Jan 6, 2017 by avibootz

Related questions

2 answers 349 views
1 answer 287 views
1 answer 313 views
2 answers 417 views
1 answer 247 views
...