Given the path of a file (e.g. "C:\MyPicture.jpg"), how do I convert a binary file into a byte array?
I know I have a lot of .NET objects at my disposal, such as BinaryReader
, FileStream
, StreamReader
, and others, but I'm not sure of the best method to take a binary file and convert it into byte[]
. How might this be accomplished?
You're looking for File.ReadAllBytes(@"C:\MyPicture.jpg")
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With