|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
UGH, Framework goes just so far AGAIN!The 2005 framework contains all kinds of cool new structures now that we have Generics and all but they always seem to fall just short of exactly what I need. In 2003 I needed a sets construct and they did not have it so I had to create one. I am not sure yet if they have one in 2005 yet BTW... I was dealing with the Dictionary last night and thought it would be a great way for me to keep a strongly types indexed list of objects and their names. The problem is that I wanted to be able to access the objects by BOTH index and name. Boy was I surprised to find that the standard Dictionary object doe snot guarantee that the order of the items added is reserved. UGH! How many times do you see cases in MS apps where you can access a collection of items by index and name via two overloaded methods? Workbooks(0) Workbooks("Book1") What the heck to they use behind the scenes? And if they have one why not share... UGH.... 3 hours latter I have an OrderedDictionary class that I had to put together myself... I know they can't anticipate everyone's needs but this one seems like something that should have made it. I have to design unit tests for all the cases to test it too. -- Raymond R Cassick CEO / CSA Enterprocity Inc. www.enterprocity.com 3380 Sheridan Drive, #143 Amherst, NY 14227 V: 716-316-5973 Blog: http://spaces.msn.com/members/rcassick/ You can enumerate through DictionaryEntry types if you like. Plus there are
a number of collection types you can use in the System.Collection namepsace. To me this is 10,000x better then the dumb old Collection class of VB6.... http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemcollections.asp Show quoteHide quote "Ray Cassick (Home)" wrote: > Ok, what is up here. > > The 2005 framework contains all kinds of cool new structures now that we > have Generics and all but they always seem to fall just short of exactly > what I need. > > In 2003 I needed a sets construct and they did not have it so I had to > create one. I am not sure yet if they have one in 2005 yet BTW... > > I was dealing with the Dictionary last night and thought it would be a great > way for me to keep a strongly types indexed list of objects and their names. > The problem is that I wanted to be able to access the objects by BOTH index > and name. Boy was I surprised to find that the standard Dictionary object > doe snot guarantee that the order of the items added is reserved. > > UGH! > > How many times do you see cases in MS apps where you can access a collection > of items by index and name via two overloaded methods? > > Workbooks(0) > Workbooks("Book1") > > What the heck to they use behind the scenes? And if they have one why not > share... > > UGH.... 3 hours latter I have an OrderedDictionary class that I had to put > together myself... > > I know they can't anticipate everyone's needs but this one seems like > something that should have made it. > > I have to design unit tests for all the cases to test it too. > > > -- > Raymond R Cassick > CEO / CSA > Enterprocity Inc. > www.enterprocity.com > 3380 Sheridan Drive, #143 > Amherst, NY 14227 > V: 716-316-5973 > Blog: http://spaces.msn.com/members/rcassick/ > > > Ray Cassick (Home) wrote:
Show quoteHide quote > Ok, what is up here. Did SortedList not do what you want?> > The 2005 framework contains all kinds of cool new structures now that we > have Generics and all but they always seem to fall just short of exactly > what I need. > > In 2003 I needed a sets construct and they did not have it so I had to > create one. I am not sure yet if they have one in 2005 yet BTW... > > I was dealing with the Dictionary last night and thought it would be a great > way for me to keep a strongly types indexed list of objects and their names. > The problem is that I wanted to be able to access the objects by BOTH index > and name. Boy was I surprised to find that the standard Dictionary object > doe snot guarantee that the order of the items added is reserved. > > UGH! > > How many times do you see cases in MS apps where you can access a collection > of items by index and name via two overloaded methods? > > Workbooks(0) > Workbooks("Book1") > > What the heck to they use behind the scenes? And if they have one why not > share... > > UGH.... 3 hours latter I have an OrderedDictionary class that I had to put > together myself... -- Larry Lard Replies to group please Ok, so I ended up building my own implementation of a Sorted List :)
But, I still have to do some digging because I am not sure if there is a sorted list that handles Generics now :) Show quoteHide quote "Larry Lard" <larryl***@hotmail.com> wrote in message news:1138090458.038580.193880@g47g2000cwa.googlegroups.com... > > Ray Cassick (Home) wrote: >> Ok, what is up here. >> >> The 2005 framework contains all kinds of cool new structures now that we >> have Generics and all but they always seem to fall just short of exactly >> what I need. >> >> In 2003 I needed a sets construct and they did not have it so I had to >> create one. I am not sure yet if they have one in 2005 yet BTW... >> >> I was dealing with the Dictionary last night and thought it would be a >> great >> way for me to keep a strongly types indexed list of objects and their >> names. >> The problem is that I wanted to be able to access the objects by BOTH >> index >> and name. Boy was I surprised to find that the standard Dictionary object >> doe snot guarantee that the order of the items added is reserved. >> >> UGH! >> >> How many times do you see cases in MS apps where you can access a >> collection >> of items by index and name via two overloaded methods? >> >> Workbooks(0) >> Workbooks("Book1") >> >> What the heck to they use behind the scenes? And if they have one why not >> share... >> >> UGH.... 3 hours latter I have an OrderedDictionary class that I had to >> put >> together myself... > > Did SortedList not do what you want? > > -- > Larry Lard > Replies to group please > The generic collections in .NET 2.0 are in System.Collections.Generic &
System.Collections.ObjectModel. You can read about SortedList(Of T) here: http://msdn2.microsoft.com/en-us/library/ms132319(en-US,VS.80).aspx There is also a SortedDictionary(Of T): http://msdn2.microsoft.com/en-us/library/f7fta44c(en-US,VS.80).aspx -- Show quoteHide quoteHope this helps Jay [MVP - Outlook] ..NET Application Architect, Enthusiast, & Evangelist T.S. Bradley - http://www.tsbradley.net "Ray Cassick (Home)" <rcassickNOSPAM@enterprocity.com> wrote in message news:%23BTrxcjIGHA.2212@TK2MSFTNGP15.phx.gbl... | Ok, so I ended up building my own implementation of a Sorted List :) | | But, I still have to do some digging because I am not sure if there is a | sorted list that handles Generics now :) | | "Larry Lard" <larryl***@hotmail.com> wrote in message | news:1138090458.038580.193880@g47g2000cwa.googlegroups.com... | > | > Ray Cassick (Home) wrote: | >> Ok, what is up here. | >> | >> The 2005 framework contains all kinds of cool new structures now that we | >> have Generics and all but they always seem to fall just short of exactly | >> what I need. | >> | >> In 2003 I needed a sets construct and they did not have it so I had to | >> create one. I am not sure yet if they have one in 2005 yet BTW... | >> | >> I was dealing with the Dictionary last night and thought it would be a | >> great | >> way for me to keep a strongly types indexed list of objects and their | >> names. | >> The problem is that I wanted to be able to access the objects by BOTH | >> index | >> and name. Boy was I surprised to find that the standard Dictionary object | >> doe snot guarantee that the order of the items added is reserved. | >> | >> UGH! | >> | >> How many times do you see cases in MS apps where you can access a | >> collection | >> of items by index and name via two overloaded methods? | >> | >> Workbooks(0) | >> Workbooks("Book1") | >> | >> What the heck to they use behind the scenes? And if they have one why not | >> share... | >> | >> UGH.... 3 hours latter I have an OrderedDictionary class that I had to | >> put | >> together myself... | > | > Did SortedList not do what you want? | > | > -- | > Larry Lard | > Replies to group please | > | | Have you tried System.Collections.Specialized.OrderedDictionary or
System.Collection.Generics.SortedDictionary (new in 2.0) ? For set operations you could also likely implement this using the BitArray class (also available in 1.1) -- Show quoteHide quotePatrice "Ray Cassick (Home)" <rcassickNOSPAM@enterprocity.com> a écrit dans le message de news:uFnRcIKIGHA.516@TK2MSFTNGP15.phx.gbl... > Ok, what is up here. > > The 2005 framework contains all kinds of cool new structures now that we > have Generics and all but they always seem to fall just short of exactly > what I need. > > In 2003 I needed a sets construct and they did not have it so I had to > create one. I am not sure yet if they have one in 2005 yet BTW... > > I was dealing with the Dictionary last night and thought it would be a great > way for me to keep a strongly types indexed list of objects and their names. > The problem is that I wanted to be able to access the objects by BOTH index > and name. Boy was I surprised to find that the standard Dictionary object > doe snot guarantee that the order of the items added is reserved. > > UGH! > > How many times do you see cases in MS apps where you can access a collection > of items by index and name via two overloaded methods? > > Workbooks(0) > Workbooks("Book1") > > What the heck to they use behind the scenes? And if they have one why not > share... > > UGH.... 3 hours latter I have an OrderedDictionary class that I had to put > together myself... > > I know they can't anticipate everyone's needs but this one seems like > something that should have made it. > > I have to design unit tests for all the cases to test it too. > > > -- > Raymond R Cassick > CEO / CSA > Enterprocity Inc. > www.enterprocity.com > 3380 Sheridan Drive, #143 > Amherst, NY 14227 > V: 716-316-5973 > Blog: http://spaces.msn.com/members/rcassick/ > > In addition to the other comments:
| I was dealing with the Dictionary last night and thought it would be a It sounds like you may want an great | way for me to keep a strongly types indexed list of objects and their names. System.Collections.ObjectModel.KeyedCollection(Of T) http://msdn2.microsoft.com/ms132438(en-US,VS.80).aspx As it works very similiar to how Office (Word, Excel) collections work. NOTE: KeyedCollection is based on each object being "Named", rather then storing key/value pairs. Other collection classes I find useful for "domain models": System.Collections.ObjectModel.Collection(Of T) http://msdn2.microsoft.com/ms132397(en-US,VS.80).aspx System.Collections.ObjectModel.ReadOnlyCollection(Of T) http://msdn2.microsoft.com/ms132474(en-US,VS.80).aspx Another source for various collections is Power Collections: http://www.wintellect.com/powercollections/ -- Show quoteHide quoteHope this helps Jay [MVP - Outlook] ..NET Application Architect, Enthusiast, & Evangelist T.S. Bradley - http://www.tsbradley.net "Ray Cassick (Home)" <rcassickNOSPAM@enterprocity.com> wrote in message news:uFnRcIKIGHA.516@TK2MSFTNGP15.phx.gbl... | Ok, what is up here. | | The 2005 framework contains all kinds of cool new structures now that we | have Generics and all but they always seem to fall just short of exactly | what I need. | | In 2003 I needed a sets construct and they did not have it so I had to | create one. I am not sure yet if they have one in 2005 yet BTW... | | I was dealing with the Dictionary last night and thought it would be a great | way for me to keep a strongly types indexed list of objects and their names. | The problem is that I wanted to be able to access the objects by BOTH index | and name. Boy was I surprised to find that the standard Dictionary object | doe snot guarantee that the order of the items added is reserved. | | UGH! | | How many times do you see cases in MS apps where you can access a collection | of items by index and name via two overloaded methods? | | Workbooks(0) | Workbooks("Book1") | | What the heck to they use behind the scenes? And if they have one why not | share... | | UGH.... 3 hours latter I have an OrderedDictionary class that I had to put | together myself... | | I know they can't anticipate everyone's needs but this one seems like | something that should have made it. | | I have to design unit tests for all the cases to test it too. | | | -- | Raymond R Cassick | CEO / CSA | Enterprocity Inc. | www.enterprocity.com | 3380 Sheridan Drive, #143 | Amherst, NY 14227 | V: 716-316-5973 | Blog: http://spaces.msn.com/members/rcassick/ | |
forms collection?
vb.net / vs2005 Modifying a text file Help with truncating VS2005 - How do you... I can't figure out how to solve this problem. pull individual data element from a datasource? how to? accessing CD/DVD-ROM without drive letters .NET2.0: Performance von String-Operationen TimeZone problems |
|||||||||||||||||||||||