.Net late binding?

G

Guest

I have a new position in which Studio 6 is still in use, due to the client
machines. While they're no dogs, they do have a lot running on them and are
using WinXP Pro.
Using VB6, I could minimize memory footprints by using late binding to
create a class from a dll rather than importing the entire dll (e.g. Set rs =
CreateObject("ADODB.Recordset").

Is the same possible with .Net? If I declare a variable with a fully
qualified namespace (without importing the parent namespace), am I getting
just that class or is .Net still importing the entire parent structure into
memory (e.g. Dim sr as System.IO.StreamReader without using "Imports
System.IO")?

Also, if XP is using the .Net runtime for OS cycles, am I adding anything to
memory by creating, say, a System.IO.StreamReader or a
System.Data.Odbc.OdbcConnection object?

Thanks for any thoughts or insight.
 
P

Patrice

I'm not sure what kind of reduction you are talking about. AFAIK a DLL is
loaded in its entirety even if you use a single object in it using late
binding. I'm no sure how you saw a memory footprint benefit (perhaps on
startup as it could be that all needed DLLs were loaded at startup instead
of loading them as needed).

AFAIK .NET is smart enought to defer loading until the corresponding
assembly is really needed. I wouldn't bother with what lloks like to me as
micro optimizations...

I'm not sure what you meant by the last part. Creating an object always
consume memory.
 

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

Top