Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the maximum number of parameters for a method (WebApi ? )

I have this method in WebApi

[IHttpActionResult]
[Get]
public void GetSome(P1, P2 ....... Pn)
{
   ...///
}

Just curious:

Any ideas, what is the maximum number of parameters allowed by WebApi for this method ?

like image 224
now he who must not be named. Avatar asked Dec 19 '22 09:12

now he who must not be named.


1 Answers

You mean technically or practically? :p

The C# method parameter limit is 65,535. Most browsers only support an URL of 2000 to 4000 characters. Depending on the consumer of your API, there might be some restrictions there as well.

But most importantly: what are you trying to do? Seriously?

You're creating an API, simple methods that are easy to understand should be your main goal. I'm not sure a method with 65000 parameters would be anywhere near simple.

To me this sounds like step 1 of a walk down "OMG kill this code" lane :)

like image 139
Kristof Avatar answered Jan 12 '23 00:01

Kristof