Showing posts with label Optional Parameters. Show all posts
Showing posts with label Optional Parameters. Show all posts

Optional Parameters in .Net

Optional Arguments were introduced in C# 4.0 and this article will show you how to use them. Optional Arguments are necessary when you specify functions that have a large number of arguments. It can cut down time by making you pass on argument values to the most needy parameters in a situation. 

Optional Arguments are what their name suggests i.e. even if you do not specify them, its perfectly OK. But it doesn't mean that they have not taken a value. In fact we specify some default values that the Optional Parameters take when values are not supplied in the function call. In this way we gain the functionality of easily setting values once and using these values several times as a default unless something different is needed.