How to create byte array with min and max values in C#

1 Answer

0 votes
using System;
 
class Program {
    static void Main() {
        byte[] barray = new byte[3];
        
        barray[0] = byte.MinValue;
        barray[1] = 0;
        barray[2] = byte.MaxValue;


        foreach (var element in barray) {
            Console.WriteLine(element);
        }
    }
}

 
 
/*
run:
 
0
0
255
 
*/

 

 



answered May 27, 2024 by avibootz

Related questions

1 answer 167 views
167 views asked Sep 12, 2020 by avibootz
1 answer 152 views
1 answer 157 views
157 views asked Sep 12, 2020 by avibootz
1 answer 154 views
1 answer 194 views
1 answer 165 views
...