vb.net - Creating a byte array using the long datatype? -


Most of the time when we read the file stream in a byte array, we will write the following code: -

  Inputstream as new system IOFileStream (FilePath, IO.filemoda.On) Integrated Dimension file as desired intact = CType (inputstream. Length, integer) Dim input (file length) input byte as input. Using Reed (Input, 0, File Length) Ending  

But here the length must be converted to an integer type (line 2 of the above code), because we use long data byte Can not declare array type (strict with option) Is this a good practice? What is the work around for this problem?

There is good practice instead of the whole thing:

Slow input = File. Read AllBytes (filePath)

By the way, if your file that large (greater than 4 GB), you would not want to load it once in a byte array because It will take 4 GB RAM (and 32 bit in process), you can not do it at all, even if you have more RAM).


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -