What’s bigger than byte.MaxValue?
Well – byte.MinValue, of course!
Only that I didn’t think of that, and neither did the person whose code raised the weird exception that led me to this.
Can’t find anything on this on the web, which usually suggest everybody knows this but me, but it turns out that -
byte b = byte.MaxValue;
displays ‘0’, and so equally -
b = byte.MinValue ;
And I totally did not know that.
Conclusion – no matter how ‘efficient’ you want to be – don’t use bytes in a loop unless you know what you’re doing! :-)