Correct way to use Assembly.Load(byte())?

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)
....
 
B

Bruce Barker

sure. but because you are loading an assembly from memory, if that assembly
references another assembly, you should load that one first (as you have a
rather restricted search path).

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top