saboh12617
Board Regular
- Joined
- May 31, 2024
- Messages
- 131
- Office Version
- 365
- Platform
- Windows
Hello,
I am currently working on a set of two classes: one being a custom object model, and the latter a custom Dictionary class, with my 1st class as key, and the items being arraylists.
I am facing a problem for which i am completely aware and kinda anticipated. It is explained here in details excel - Acces an item in a dictionary with a custom object key in vba - Stack Overflow
But basically when i want to check my keys list to retrieve a "new" item, i can not find it because it has a different pointer from the original one added in the list, even if all of their properties are equal.
I created in my class a custom .Equals function, to handle this problem manually. But i dont know how i can "force" my custom dictionary to use this function instead of simply looking the addresses of the objects in the memory. Is it even possible?
I guess i will have to loop on all the keys and apply my Equals function on all of them, to retrieve the "original object", and use it. But doing so, where should this code be applied? In the MyDictionnary.Keys functions?
I can post some code if it helps, but the problem is more about how to overpass the default Key search on a custom dictionary.
I am currently working on a set of two classes: one being a custom object model, and the latter a custom Dictionary class, with my 1st class as key, and the items being arraylists.
I am facing a problem for which i am completely aware and kinda anticipated. It is explained here in details excel - Acces an item in a dictionary with a custom object key in vba - Stack Overflow
But basically when i want to check my keys list to retrieve a "new" item, i can not find it because it has a different pointer from the original one added in the list, even if all of their properties are equal.
I created in my class a custom .Equals function, to handle this problem manually. But i dont know how i can "force" my custom dictionary to use this function instead of simply looking the addresses of the objects in the memory. Is it even possible?
I guess i will have to loop on all the keys and apply my Equals function on all of them, to retrieve the "original object", and use it. But doing so, where should this code be applied? In the MyDictionnary.Keys functions?
I can post some code if it helps, but the problem is more about how to overpass the default Key search on a custom dictionary.