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.