Generic.Dictionary vs Word.Dictionary

K

Ken Wilson

I am building an add-in for Microsoft Word 2003 using VS 2005. I am
attempting to create an instance of
System.Collections.Deneric.Dictionary<> and seem to be running into an
ambiguity problem with the Microsoft.Interop.Word.Dictionary
interface.

It appears I can declare my Dictionary object as the code compiles
with this statement in place;

Dictionary<string, string> cTransformDictionary =
new Dictionary<string, string>();

However, when I go to use the object, Intellisense does not bring up
cTransformDictionary in its list of available options nor does VS
accept the code if typed in ignoring Intellisense, ie

cTransformDictionary.Add("key", "value");


The code does not compile either, giving the following error message;

Invalid token '(' in class, struct, or interface member declaration

I have also tried to remove ambiguity by being verbose, i.e.
System.Collections.Generic.Dictionary etc., but to no avail.

I have the necessary using directives for both Office, Word and
System.Collections.Generic along with others and the proper references
are in place. If anyone knows about this problem and can point to
some potential solutions it is much appreciated.
 
Top