I have a dictionary that I want to access with a key that is the combination of a string (AcctNum
) and a date (BalDate
).
It seems to me the simplest approach is to create the key by simply converting the date to a string and concatenating:
MyKey = BalDate.ToString & "|" & AcctNum
I know I also have the option of creating a composite key by writing a separate class and overriding GetHashCode()
and Equals()
a la this solution.
To me, the concatenated string is a simpler, if somewhat less elegant, solution. Am I missing some compelling reason why I should go with the composite key class approach?
This lookup is the crux of the project I am working on, so performance is my main objective (with readability a close second).