This repository was archived by the owner on Mar 8, 2026. It is now read-only.
Replies: 1 comment
-
|
I note that above I have a typo. Where I said In SomeClass, the implementation's Friend Property Get ArrayList_NewEnum() As IUnknown, Get ArrayList_NewEnum() should be IArrayList_NewEnum(). Apologies for any confusion this may cause. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Rubberduck World:
I have an interface class (say ISomeClass) and a concrete class implementation for it (say SomeClass).
They utilize a VBA Collection to hold certain data, and each of these classes has a NewEnum property getter.
In ISomeClass, the interface's Public Property Get NewEnum() As IUknown is Rubberduck annotated with @enumerator and @MemberAttribute VB_MemberFlags, "40" [I've also tried "68" and "100"], and the exported .cls module file show that it has Attribute NewEnum.VB_UserMemId = -4 and Attribute NewEnum.VB_MemberFlags = "40" [or, as the case may be, "68" or "100"].
In SomeClass, the implementation's Friend Property Get ArrayList_NewEnum() As IUnknown is Rubberduck annotated with @MemberAttribute VB_MemberFlags, "40" [again, I've also tried "68" and "100"], and the exported .cls module file show that it has Attribute NewEnum.VB_MemberFlags = "40" [or, as the case may be, "68" or "100"]. Note that the VBIDE won't permit the @enumerator annotation to also insert (or keep) Attribute NewEnum.VB_UserMemId = -4 in the code.
This structure works just fine, and solved a problem I had previously been having in getting an enumerator for a ,NET class through the COM interface (and about which, Mathieu and I have communicated), which solution was to copy the underlying .NET classes' elements to the Collection and then iterating the Collection through the NewEnum property drawing on the Collection's [_NewEnum] property.
However, notwithstanding the @enumerator annotation/Attribute NewEnum.VB_UserMemId = -4, and the @MemberAttribute VB_MemberFlags, "40"/Attribute NewEnum.VB_MemberFlags = "40"[ or ...], which should result in hiding NewEnum as a property of ISomeClass from the "outside world", this results in NewEnum being shown in the Intellisense for an object of the ISomeClass type.
I know that this is not a Rubberduck issue (because the two annotations are producing just the attributes that they are supposed to produce), but, rather, is a VBA issue, but is there any way to hide, as it should be hidden, the NewEnum property from the public interface Intellisense?
I have tried various combinations of making the NewEnum getter private, or only in the concrete class, but then the For Each Item in ISomeClass statement just doesn't work.
Perhaps this is something with which I must just live, but it offends my coding sensibilities.
Any insights would be appreciated.
Also, love Rubberduck and anxiously await RD3.
Thanks, Nick.
Beta Was this translation helpful? Give feedback.
All reactions