I am trying to create a class to control the opening of a specific file. I would like one of the properties to be a byte array of the file, but I don't know how big the file will be. I tried declaring an array of bytes as:
public byte[] file;
... but that will not allow me to install it the way I tried. br my BinaryReader:
file = br.ReadBytes(br.BaseStream.Length); br.Read(file,0,br.BaseStream.Length);
None of the methods work. I assume this because I did not initialize the byte array, but I do not want to give it a size if I do not know the size. Any ideas?
edit: Okay, I think because the length of the Binary Reader BaseStream is long, but its readers take int32. If I transfer 64s to 32s, is it possible that I will lose bytes in large files?
source share