Sunday, August 08, 2010

Named arguments and Optional Parameters

Optional parameters - the ability to define a function parameter with a default value. When the function is called, the caller can pass the parameter value if not the default value is used.

Named arguments - C# now provides an ability to name the argument and pass the value along with that in a function call.

VB.NET had it for a while. This will be useful when you code with COM API's.

Note: Optional parameters must be specified at the end (after defining the required parameters)

No comments:

Post a Comment