Array or hash table to store value/pair?

  • Thread starter Thread starter Ronald S. Cook
  • Start date Start date
R

Ronald S. Cook

In my Windows app, I want to keep track of previous "screens" visited (like
a browser does in a web app). On some screens (e.g. Employee Detail), there
would be an EmployeeID to retain to retrieve not just thayt they were on the
Employee Detail screen, but that they were looking at Jane Smith's record.

So I was thinking I would store value/pairs in memory (in order of course):

Screen ID (if applicable)
EmployeeDetail 123
EmployeeList Null
SomeOtherScreen Null

QUESTION: Array or hash table? Or other? Reasoning?

Thanks,
Ron
 
Ronald S. Cook said:
In my Windows app, I want to keep track of previous "screens" visited
(like a browser does in a web app). On some screens (e.g. Employee
Detail), there would be an EmployeeID to retain to retrieve not just thayt
they were on the Employee Detail screen, but that they were looking at
Jane Smith's record.

So I was thinking I would store value/pairs in memory (in order of
course):

Screen ID (if applicable)
EmployeeDetail 123
EmployeeList Null
SomeOtherScreen Null

QUESTION: Array or hash table? Or other? Reasoning?

You could create your own object that represents the "screen" and the
required information and maintain a Queue<VisitedScreen>. It will keep the
order and will also allow you to Dequeue once you exceed the amount of
"history" you want to maintain.

PS
 
Back
Top