An object-oriented programming language developed by Microsoft that can be used in .NET.
Try this:
Dim MyCopy As Byte() = MyFileAsByte.ToArray
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello experts,
I'm not familiar with byte arrays, anyhow will need to load and hold a fie as byte:
Public MyFileAsByte As Byte() = Nothing
Dim MyBR As BinaryReader = Nothing
Try
MyBR = New BinaryReader(File.OpenRead("D:\file.ext"))
Dim MyFI As New FileInfo("D:\file.ext")
MyFileAsByte = MyBR.ReadBytes(Convert.ToInt32(MyFI.Length))
Finally
If Not MyBR Is Nothing Then MyBR.Close()
End Try
Now each time I need to access MyFileAsByte, I have to make a copy of it, and pass the copy to some functions (because they might alter the passed byte)
So how do you make an exact copy of MyFileAsByte now? (with no more access to the original file ie "D:\file.ext"
Without altering the original byte (MyFileAsByte)?
Thanks :)
An object-oriented programming language developed by Microsoft that can be used in .NET.
Answer accepted by question author
Try this:
Dim MyCopy As Byte() = MyFileAsByte.ToArray