2

I have 3 parameters that I am passing to WebMethod but I don't want them to pass as separate 3 parameters. Then I know solution is to pass object but that object must have structure in C#. Is there any other way so that I don't need to build a class and pass parameters in anonymous one? like var or dynamic?

Imad
  • 7,126
  • 12
  • 55
  • 112
  • Please check this http://stackoverflow.com/questions/18078957/pass-a-user-defined-object-to-asp-net-webmethod-from-jquery-using-json/18079544#18079544 – Kaushik Maheta Sep 14 '15 at 06:11
  • @KaushikMaheta thanks for the comment. I know it is the way but here I have to define structure of class, I am finding the way to pass ANONYMOUS one. :) – Imad Sep 14 '15 at 06:13
  • What's wrong in defining a class? As far as I know you can't use `var` here. You can use an string array though depending upon the type of data you want to send. – Rahul Singh Sep 14 '15 at 06:23
  • Nothing wrong, I did that indeed. Just wanted to know alternative to reduce typing efforts ;) – Imad Sep 14 '15 at 06:30
  • you can use the word `dynamic` and send the object without class structure – J Santosh Sep 14 '15 at 06:34
  • Thanks, I will consider your advise. – Imad Sep 14 '15 at 06:41

0 Answers0