So, I have wanted to dive into the world of generics for some time now. I have read and read about the stack, queue, and the dictionary classes but just didnt have a need until now. recently on project foo, the need to use an "anchor" that would never change and get back the current display text was presented. I considered my options, we could query for each value... No, there would be many many instances of this need on the same page, and though stored procs are fast, I felt that would be clumsy. Then a light came on, use the dictionary object.
I tried to take it a step farther and use a linq query and the todictionary extension method, to create my dictionary, unfortunatly this went nowhere. I was able to write the needed statement for the linq query, but had many problems with the todictionary method. I suspect it is partly because i am new to both generics and linq. I found that there were few good examples of how to use the todictionary method that I could reference, so I ended up doing it the old fashon way, creating a dataset, then creating a dictionary, and finally itterating over the dataset/datatable and adding each record.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment