Is there an equivalent to func_get_arg (php) in C#?
func_get_arg ( int $arg_num ):
Gets the specified argument from a user-defined function’s argument list.
This function may be used in conjunction with func_get_args() and func_num_args() to allow user-defined functions to accept variable-length argument lists.
It basically means the index can be used to get the argument value…
Thanks
C# is statically typed, so function signatures matter. You can’t just call a method with any number of arguments, which really means there is no need for
func_get_arg.That said, you can get pretty close if you have a method such as this one:
Of course if all your arguments are typed as
System.Objectthere’s not much you can do with them, but from a syntactic viewpoint it’s close (plus, you could also have a method that acceptsparams T[] argsfor any typeT).