Post

Pop-Quiz - FileStream.ReadByte() returns what type of value?

I’m working on some file i/o stuff today and pretty much using FileStream.Read using a Byte array as the buffer. However, there was one portion where I just need to seek and look at one Byte. So, there’s this FileStream.ReadByte() method that looked like the perfect thing. However, since I have Option Strict On, the code immediately barked at me saying it couldn’t convert from Integer to Byte??????? Huh?

So if you thought that it would return Byte, wrong answer… it returns an Integer. Not really sure why this is… if anyone knows why, please enlighten us ;-)

This post is licensed under CC BY 4.0 by the author.