Hi Pamela,
In the following lines:
class DictionaryWrapper<Key, Value>
{
private Dictionary<Key, Value> m_dict = new Dictionary<Key, Value>();
That's where the wrapper passes the types that it accepts straight to the
internal Dictionary object (note <Key, Value> pairs). Key is a type, Value
is a type.
Then when you create the wrapper object, you specify the exact types that
you want it to handle:
DictionaryWrapper<string, int> wrapper = new DictionaryWrapper<string,
int>();
Note <string, int> pairs: string is the type for keys, int is the type for
values. Of course you can do with other types of your choice.
<string, string>, <int, string>, <int, long>, etc...
"pamela fluente" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On 9 Feb, 20:53, "Ashot Geodakov" <a_geoda...@hotmail.com> wrote:
>> Hi Pamela,
>>
>> here's a small sample based on what I could understand from your
>> requirements:
>>
>> using System;
>> using System.Collections.Generic;
>> using System.Windows.Forms;
>>
>> namespace WindowsApplication1
>> {
>> class DictionaryWrapper<Key, Value>
>> {
>> private Dictionary<Key, Value> m_dict = new Dictionary<Key,
>> Value>();
>
>
> Thanks Ashot .
>
> My problem is I do not know how to pass the types that are declared
> externally (as parameters for the wrapper constructor)
> for the Key and the Value to the internal typed dictionary
>
> System.Collections.Generic.Dictionary(Of MyObjectType1, MyObjectType2)
> (MyComparer)
>
> I do not see any type declaration in your code. I am not sure
> whether you have provided
> the answer to what I was looking for ...
>
> Perhaps c# and vb are too different here or I do not get it ...
>
> mmm I am having hard time with this one.
>
> Anyone more suggestions ?
>
> -Pam
>
>
>
|