Because subtraction is coercing up to an integer. As I recall, byte is an unsigned type in C#, so subtraction can take you out of the domain of bytes.
More Related Contents:
- String was not recognized as a valid DateTime ” format dd/MM/yyyy”
- Cast List to List
- How do I check the number of bytes consumed by a structure?
- Casting a result to float in method returning float changes result
- Value of type ‘T’ cannot be converted to
- Convert any object to a byte[]
- string = string + int: What’s behind the scenes?
- Does .NET provide an easy way convert bytes to KB, MB, GB, etc.?
- How can I cast int to enum in C#?
- How do I cast int to enum in C#?
- convert double to int
- How can I convert BitArray to single int?
- C# testing to see if a string is an integer?
- Why enums require an explicit cast to int type?
- How to know the size of the string in bytes?
- Compile-time and runtime casting c#
- Generics: casting and value types, why is this illegal?
- Best way to handle Integer overflow in C#?
- Invalid cast from ‘System.Int32’ to ‘System.Nullable`1[[System.Int32, mscorlib]]
- Why is a SQL float different from a C# float
- Byte to Binary String C# – Display all 8 digits
- Why does null need an explicit type cast here? [duplicate]
- .NET Casting Generic List
- Maximum number of threads in a .NET app?
- Is floating-point math consistent in C#? Can it be?
- How to put a task to sleep (or delay) in C# 4.0?
- How do I get information about recently connected USB device?
- Why is AddRange faster than using a foreach loop?
- Setting the initial directory of an SaveFileDialog?
- How do I transform appsettings.json in a .NET Core MVC project?