|
-
Dec 28th, 2014, 01:38 PM
#13
Re: [VB6] Problem Using CopyMemory API to Get Collection Keys
This turns out to be a lot less useful than I imagined it might be. I went and looked at some smaller projects where I had been using small value classes to be stored into Collections.
Even when the only thing I defined in the class were a Value and a Name (String), I was concerned about case-insensitivity. I wanted a case-insensitive lookup by Key (Name), but I needed to be able to retrieve the "canonical" Name with proper casing.
For example a code editor handling a VB-like language (in my case it was VBScript).
I wanted the most recently loaded, edited, or entered "definition statement" to determine the case of the identifiers, just as in the VB6 IDE's code editing windows. For example if a script had:
Dim somethingSpecial
... and then I edited that to be:
Dim SomethingSpecial
... the new "SomethingSpecial" needed to become the stored symbol, as well as then being updated throughout the script to match the new casing. Removing and then re-Adding the item isn't especially efficient either.
So in the end I still needed a value class anyway. Fetching the Key based on Index really isn't as useful as one might be tempted to imagine, and for that matter you often need to store more than a single value per item anyway.
Maybe Microsoft knew what they were doing all along.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|