473,322 Members | 1,778 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

strong type dictionary

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
2 937
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

53
by: dterrors | last post by:
Will php 6 do strong typing and/or namespaces? I was shocked to find out today that there are some people who actually argue that weak typing is somehow better. I didn't even know there was a...
94
by: Gabriel Zachmann | last post by:
Is it correct to say that strong/weak typing does not make a difference if one does not use any pointers (or adress-taking operator)? More concretely, I am thinking particularly of Python vs C++....
0
by: Dan Holmes | last post by:
I have created an interface (A) and also and interface for the collection (or dictionary) of A. I was going to have the implementation inherit from DictionaryBase but in a for each loop (VB) the...
20
by: Razzie | last post by:
Hey all, I'm really going through a small hell right now - I've completely lost it :) I made a project, using two interop libraries from exchange (created them as in this msdn article:...
8
by: Tamir Khason | last post by:
Following the code: Assembly myAssembly = Assembly.LoadFrom(FileName); foreach (Type myType in myAssembly.GetTypes()) {Do_whatever()}
10
by: farseer | last post by:
I'd like my collections to contain specific types of objects. Most of the topics i read on this involves creating a custom collection class that extends DictionaryBase or IEnumerable. But this...
10
by: Bob | last post by:
This has been bugging me for a while now. GetType isn't availble for variables decalred as interface types, I have to DirectCast(somevariable, Object). In example: Sub SomeSub(ByVal...
4
by: Bill Woodruff | last post by:
< note : this message was sparked in part by comments by David Browne on a previous thread : "inserting an anonymous method as a value in a generic dictionary ?" : David had shown the use of...
1
by: fsx | last post by:
I have a class that accepts objects via an add method and then stores them in a list of objects: public class tagBuilder private _store as Dictionary(Of String, Object) public sub...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.