C
Chris Dunaway
I have created an Interface called IClientModule in a class libarary and
have compiled the library to a .dll.
In my main app, I scan a folder for .dll's and load each one that
implements the interface. For each one that is loaded, it is stored in a
collection object which is an instance of a typed collection class called
ModuleCollection.
In the code, I want to iterate through the collection so I tried this code:
For Each oMod As IClientModule In m_Modules
...
Next
When it gets to that line of code, it pukes with an "Specified Cast is
Invalid" on the For Each line.
Yet if I change the code to this:
Dim oMod As IClientModule
For x As Integer = 0 To m_Modules.Count - 1
oMod = m_Modules(x)
oMod.InitializePlugin(AppContext)
Next
It works!?!?! What gives? Why would it fail with For Each?
--
Chris
dunawayc[AT]sbcglobal_lunchmeat_[DOT]net
To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
have compiled the library to a .dll.
In my main app, I scan a folder for .dll's and load each one that
implements the interface. For each one that is loaded, it is stored in a
collection object which is an instance of a typed collection class called
ModuleCollection.
In the code, I want to iterate through the collection so I tried this code:
For Each oMod As IClientModule In m_Modules
...
Next
When it gets to that line of code, it pukes with an "Specified Cast is
Invalid" on the For Each line.
Yet if I change the code to this:
Dim oMod As IClientModule
For x As Integer = 0 To m_Modules.Count - 1
oMod = m_Modules(x)
oMod.InitializePlugin(AppContext)
Next
It works!?!?! What gives? Why would it fail with For Each?
--
Chris
dunawayc[AT]sbcglobal_lunchmeat_[DOT]net
To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.

zsX-EkdZZ(IVnFRTX%!:Sv^L&Gk~s]vJ@Z~%Rm@G]fr*r2P}u5 *&k/-_2+&Qowj6hiJ1b$^JQf:uy9456HIdKq*B`NC##kyO,>7"Ztnav+=71b*"E+DIme;{i&)ii{#6e?i8P,1Xpc[q0}i:Tm];B1