By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,344 Members | 1,139 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,344 IT Pros & Developers. It's quick & easy.

strong type dictionary

P: n/a
GS
If I want to construct a dictionary with a string key of max length of 16,
value of a list, an object or struct, say mystuff. mystuff consists of 2
properties:
sequence as integer
string value with max length of 2048
how would I go about it?

I expect only about 50 to 80 entries in the dictionary
Nov 11 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"GS" <gs**********************@msnews.Nomail.comschrieb :
If I want to construct a dictionary with a string key of max length of 16,
value of a list, an object or struct, say mystuff. mystuff consists of 2
properties:
sequence as integer
string value with max length of 2048
how would I go about it?

I expect only about 50 to 80 entries in the dictionary

'System.Collections.Generic.Dictionary(Of TKey, TValue)'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 11 '06 #2

P: n/a
GS wrote:
If I want to construct a dictionary with a string key of max length of 16,
value of a list, an object or struct, say mystuff. mystuff consists of 2
properties:
sequence as integer
string value with max length of 2048
how would I go about it?
Create a class inherited from DictionaryBase or CollectionBase.

This gives you the ability to intercept values as they are coming in (so
you can check key lengths, etc.), and to add strongly typed Add and Item
methods/properties, but handles the data storage for you.

HTH,
Phill W.
Nov 15 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.