469,588 Members | 2,824 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,588 developers. It's quick & easy.

UGH, Framework goes just so far AGAIN!

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/
Jan 24 '06 #1
6 1004
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/de...ollections.asp

"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/

Jan 24 '06 #2

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

Jan 24 '06 #3
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)

--
Patrice

"Ray Cassick (Home)" <rc************@enterprocity.com> a écrit dans le
message de news:uF*************@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/

Jan 24 '06 #4
In addition to the other comments:

| 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.
It sounds like you may want an
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/

--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Ray Cassick (Home)" <rc************@enterprocity.com> wrote in message
news:uF*************@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/
|
|
Jan 24 '06 #5
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" <la*******@hotmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.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

Jan 26 '06 #6
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/lib...US,VS.80).aspx

There is also a SortedDictionary(Of T):

http://msdn2.microsoft.com/en-us/lib...US,VS.80).aspx
--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Ray Cassick (Home)" <rc************@enterprocity.com> wrote in message
news:%2****************@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" <la*******@hotmail.com> wrote in message
| news:11**********************@g47g2000cwa.googlegr oups.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
| >
|
|
Jan 26 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by fripper | last post: by
6 posts views Thread by Joseph Geretz | last post: by
23 posts views Thread by Nak | last post: by
4 posts views Thread by Steve | last post: by
13 posts views Thread by dancer | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.