473,322 Members | 1,526 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.

Wrapping a typed Dictionary or any collection


Wrapping the old classic collections was straightforward. But with
System.Collections.Generic we have that particular constructor (Of
SomeType...) and I am not clear how I can wrap these typed
collections.

I want to wrap a System.Collections.Generic.Dictionary. The wrapping
class should have a constructor similar to that of the dictionary
(besides some possible other argument).

Intuitively I want something "like":

'------------------------------------
Class DictionaryWrapper

Public Whatever As WhateverObject

Public MyDict As System.Collections.Generic.Dictionary(Of
MyObjectType1, MyObjectType2)(MyComparer)

Sub New(ByVal MyObjectType1 as type?, ByVal MyObjectType2 as
type?, ByVal MyComparer as IComparer , ByVal WhateverObj)

Me.MyDict = New System.Collections.Generic.Dictionary(Of
MyObjectType1, MyObjectType2)(MyComparer)

Me.Whatever = WhateverObj

End Sub

End Class
'------------------------------------

but I cannot see the right syntax to implement this idea. Could
anyone suggest how I can create such a wrapper ?

If possible I would like to know some "strategy" that allows to wrap
any typed collection.

Thank you very much

-Pam

Feb 6 '07 #1
0 945

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

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...
8
by: Dgates | last post by:
Has anyone typed up an index for the O'Reilly book "C# and VB.NET Conversion?" I'm just learning C#, and often using this little book to see which VB.NET terms translate directly to some term in...
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...
2
by: Ian Gore | last post by:
Hi, I'm relatively new to VB.NET so I'd be grateful if someone could point out what I don't understand here... 1) Creating a strongly typed collection by inheriting CollectionBase. This is...
20
by: Dennis | last post by:
I use the following code for a strongly typed arraylist and it works great. However, I was wondering if this is the proper way to do it. I realize that if I want to implement sorting of the...
1
by: Martin Widmer | last post by:
Hi Folks. When I iterate through my custom designed collection, I always get the error: "Unable to cast object of type 'System.Collections.DictionaryEntry' to type...
5
by: Simon | last post by:
Hi all, I am writing a windows application using vb.net on the 1.1 framework. We have in the application, some strongly typed collections that have been written as classes that do not inherit...
3
by: Simon Hart | last post by:
Hi, I am trying to implement some functionality as seen in MS CRM 3.0 whereby a basic Xml is deserialized into an object which contains properties. What I want to do from here is; cast the basic...
8
by: Andy B | last post by:
I have the object property StockContract.Dictionary which is a dictionary collection of <string, stringkey/value pairs. I need to be able to retreive the keys and their values and display them on a...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
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: 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
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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.