1

I'm Using C#.

I'm trying to create a web method in my .asmx file as follow:

[WebMethod]
public string MyWebMethod(Dictionary<string, string> parameters)
{
   //...
}

And I got the following exception:

The type System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] is not supported because it implements IDictionary.

How can i fix it?

Thanks.

CSharpBeginner
  • 601
  • 2
  • 7
  • 22

1 Answers1

1

you can't use Dictionary direct but you can use list as parameters

and this link can help you to convert List to Dictionaryand continue your flow

C# Convert List to Dictionary

Community
  • 1
  • 1
shady youssery
  • 430
  • 2
  • 17