M
mathlec
I'm struggling with an odd problem and I want to validate something.
What is the right way to load an assembly from bytes?
Is this code correct? :
....
Private Function loadBytes(filename as string) as Byte()
Dim fs As New FileStream(filename, FileMode.Open)
Dim buffer(CInt(fs.Length)) As Byte
fs.Read(buffer, 0, buffer.Length)
fs.Close()
return buffer
End Function
Dim rawAssembly() as Byte = loadBytes("aWellFormatedPath&FileName")
[Assembly].Load(rawAssembly)
....
What is the right way to load an assembly from bytes?
Is this code correct? :
....
Private Function loadBytes(filename as string) as Byte()
Dim fs As New FileStream(filename, FileMode.Open)
Dim buffer(CInt(fs.Length)) As Byte
fs.Read(buffer, 0, buffer.Length)
fs.Close()
return buffer
End Function
Dim rawAssembly() as Byte = loadBytes("aWellFormatedPath&FileName")
[Assembly].Load(rawAssembly)
....