Most of the time when we read the file stream into a byte array, we would write the following code:-
Dim inputStream As New System.IO.FileStream(filePath, IO.FileMode.Open)
Dim fileLength As Integer= CType(inputStream.Length, Integer)
Dim input(fileLength) As Byte
Using inputStream
inputStream.Read(input, 0, fileLength)
End Using
But here we have to convert Length into an integer type (line 2 of the code above) since we cannot declare a byte array using the long data type (with option strict on). Is this a good practice? What is the work around for this problem?