用索引操作创建一个类

时间:2018-06-24 16:02:13

标签: vba excel-vba excel

如何使用索引操作创建类?

我将Item属性添加到类中。这使wrapped_dict.Item(12) = 13起作用。但是wrapped_dict(12) = 13仍然无效。

这是用于包装字典以使其将大写和小写键视为相同的键。

这是我尝试过的:

Option Explicit
Private dict As New Dictionary

Property Get Item(ByRef Key As Variant) As Variant
    Item = dict(Key)
End Property

Property Set Item(ByRef Key As Variant, ByRef Item As Variant)
    dict(Key) = Item
End Property

Property Let Item(ByRef Key As Variant, ByRef Item As Variant)
    dict(Key) = Item
End Property

0 个答案:

没有答案