Byte.MinValue Field in C#

The Byte.MinValue field in C# represents the smallest possible value that a byte data type can hold. Since byte is an unsigned 8-bit integer, its minimum value is always 0.

Syntax

Following is the syntax for accessing the Byte.MinValue field −

public const byte MinValue = 0;

The field is accessed as −

byte minValue = Byte.MinValue;

Understanding Byte Range

The byte data type in C# is an unsigned 8-bit integer that can store values from 0 to 255. The Byte.MinValue constant provides the lower bound of this range.

Byte Value Range 0 255 8-bit unsigned integer Byte.MinValue Byte.MaxValue

Example

Let us now see an example to demonstrate the Byte.MinValue field −

using System;

public class Demo {
    public static void Main() {
        byte val;
        val = Byte.MinValue;
        Console.WriteLine("Minimum Value (Byte) = " + val);
        
        Console.WriteLine("Byte range: " + Byte.MinValue + " to " + Byte.MaxValue);
        Console.WriteLine("Size in bits: " + sizeof(byte) * 8);
    }
}

The output of the above code is −

Minimum Value (Byte) = 0
Byte range: 0 to 255
Size in bits: 8

Comparison with Other Data Types

Data Type Size (bits) Min Value Max Value
byte 8 0 255
sbyte 8 -128 127
short 16 -32,768 32,767
ushort 16 0 65,535

Practical Usage Example

using System;

public class ByteValidation {
    public static void Main() {
        int[] testValues = { -5, 0, 100, 255, 300 };
        
        foreach (int value in testValues) {
            if (value >= Byte.MinValue && value 

The output of the above code is −

-5 is outside byte range
0 is valid byte: 0
100 is valid byte: 100
255 is valid byte: 255
300 is outside byte range

Conclusion

The Byte.MinValue field provides the minimum value (0) for the unsigned 8-bit byte data type. It is useful for validation, range checking, and understanding the bounds of byte values in C# applications.

Updated on: 2026-03-17T07:04:35+05:30

129 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements