![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
|
_ Public Class BarEnumerator |
#2
| |||
| |||
|
|
I have defined the following ServicedComponent that currently does nothing. |
#3
| |||
| |||
|
|
Hi, I have defined the following ServicedComponent that currently does nothing. I'm clueless about VB.NET, so I don't understand why the methods/properties can be empty. The following C#-Enumerator works as expected: public class TestEnumerator : ServicedComponent, IEnumerator { readonly string[] strings = new string[] {"hello", "world"}; IEnumerator innerEnum; public TestEnumerator() { innerEnum = strings.GetEnumerator(); } public object Current { get { return innerEnum.Current; } } public void Reset() { innerEnum.Reset(); } public bool MoveNext() { return innerEnum.MoveNext(); } } bye Rob |
#4
| |||
| |||
|
|
Hi Robert, even with your dummy implementation I get the same exception. However, when I do not implement IEnumerator and use the class interface instead, everything works fine. Are there any restrictions with the IEnnumerator/IEnumVARIANT-RCW? |
#5
| |||
| |||
|
|
Jo Siffert wrote: Hi Robert, even with your dummy implementation I get the same exception. However, when I do not implement IEnumerator and use the class interface instead, everything works fine. Are there any restrictions with the IEnnumerator/IEnumVARIANT-RCW? No, they aren't. Do you implement IEnumerable somewhere? In you previous post I saw that you don't: No, I did not. Do I have to even if my class does not have collection |
|
Public Class FooManager Inherits ServicedComponent Implements IFooManager ... Function List( _ ByVal parentId As Int32 _ ) As IEnumerator Implements IFooManager.List Return New FooEnumerator(parentId, m_dbCfg) End Function You are suppose to: Public Class FooManager Inherits ServicedComponent Implements IFooManager, IEnumerable <--- Function GetEnumerator .... Return New FooEnumerator(parentId, m_dbCfg) bye Rob |
#6
| |||
| |||
|
|
Robert Jordan wrote: Jo Siffert wrote: Hi Robert, even with your dummy implementation I get the same exception. However, when I do not implement IEnumerator and use the class interface instead, everything works fine. Are there any restrictions with the IEnnumerator/IEnumVARIANT-RCW? No, they aren't. Do you implement IEnumerable somewhere? In you previous post I saw that you don't: No, I did not. Do I have to even if my class does not have collection semantics? Thanks, Jo Public Class FooManager Inherits ServicedComponent Implements IFooManager ... Function List( _ ByVal parentId As Int32 _ ) As IEnumerator Implements IFooManager.List Return New FooEnumerator(parentId, m_dbCfg) End Function You are suppose to: Public Class FooManager Inherits ServicedComponent Implements IFooManager, IEnumerable <--- Function GetEnumerator .... Return New FooEnumerator(parentId, m_dbCfg) bye Rob |
#7
| |||
| |||
|
|
it seems to have been a bug in the Framework - after installing SP1 everything works fine... |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |