CS0246: The type or namespace name 'Dictionary' could not be found and CS0305: Using the generic type 'System.Collections.Generic.IDictionary' requires '2' type arguments

I had a piece of C# vendor code to install for authentication:


IDictionary userInfo = new Dictionary();
userInfo.Add(Agent.TOKEN_SUBJECT, sAMAccountName);
userInfo.Add(“domain”, domain);


Kept getting errors:

CS0246: The type or namespace name 'Dictionary' could not be found
CS0305: Using the generic type 'System.Collections.Generic.IDictionary' requires '2' type arguments


Turns out the vendor did not specify which classes to include, so I had to do a bit of digging.  I found some posts that said Dictionary was no longer being used in .NET 2.0 (not sure about that).  To resolve this, make sure you import the following in order to instantiate a Dictionary object with 2 params:



using System;
using System.Collections;
using System.Collections.Generic;

ASP.NET, .NET 2.0

Comments

Popular posts from this blog

usoclient.exe in Windows 10 wakes up my PC with Wake Source: Unknown

How to block the Admiral anti ad-block detection message

Diskpart - "The volume you have selected may not be extended" on Windows 2003 Server when enlarging boot disk (C:) in VMware ESX 3.5