Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Named and optional parameters, and WCF

Tags:

so .Net 4 added named and optional parameters which are pretty sweet. I don't need to make as many 1 line overload methods.

Will that work over WCF?

like image 385
puffpio Avatar asked Apr 15 '10 23:04

puffpio


People also ask

Can we use optional and named arguments with constructors?

Named arguments enable you to specify an argument for a parameter by matching the argument with its name rather than with its position in the parameter list. Optional arguments enable you to omit arguments for some parameters. Both techniques can be used with methods, indexers, constructors, and delegates.

What are the differences between mandatory parameters and optional parameters?

A mandatory parameter must be explicitly given on the command-line, otherwise an error message will be printed to prompt the user to re-enter the command. If an optional parameter is not specified, the default is used. Note: Mandatory parameters have a default value for use in the GUI.

Are parameter names optional?

Named parameters are often used in conjunction with optional parameters. Without named parameters, optional parameters can only appear at the end of the parameter list, since there is no other way to determine which values have been omitted.

How do you pass optional parameters in C#?

By Params Keyword: You can implement optional parameters by using the params keyword. It allows you to pass any variable number of parameters to a method. But you can use the params keyword for only one parameter and that parameter is the last parameter of the method.


1 Answers

WSDL cannot describe optional parameters, so the answer is "no".

like image 67
John Saunders Avatar answered Oct 22 '22 10:10

John Saunders