How can I wrap a collection ? (re-repost)

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I have been posting this question with no success. I do not know if I
am not being clear of the question is too difficult :-)) or unclear.
It seems to me that the need to wrap a collection is quite common in
real world programs.

I am having problem to understand how I can wrap collections in
System.Collections.Generic.
For example I want to wrap a System.Collections.Generic.Dictionary. I
wish the wrapping class to have a constructor similar to that of the
dictionary (besides some possible other argument).

I think it should be actually simple, but I cannot see the right
syntax to implement this idea. Could anyone suggest how ?

Intuitively I want something "like" (please * excuse me * if I use the
VB notation, which I am familiar with, I will have no problem to
understand any C# solution to my question )

'------------------------------------
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 as
WhateverObject )

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

Me.Whatever = WhateverObj

End Sub

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

Thanks


-Pam

.



Relevant Pages

  • Re: How can I wrap a collection ? (re-repost)
    ... It seems to me that the need to wrap a collection is quite common in ... Public Whatever As WhateverObject ... Sub New(ByVal MyObjectType1 as type?, ByVal MyObjectType2 as ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Return Multiple Values from a Custom Function
    ... When it is about an object you can even use a sub ... Private Function a (byval b as whateverObject) as whateverObject ...
    (microsoft.public.dotnet.languages.vb)