The printf function of the C language, the number of parameters can be variable. Implemented using Va_start and va_end.
In C + +, you can use overload to implement variable parameters. If the number of parameters is not many, you can implement a function of a parameter, two parameters to implement a function, three parameters to implement a function ...
Or use the C scheme.
In C #, you can also use overload. or the params keyword.
The following code, in addition to demonstrating the params to implement a variable number of parameters, also demonstrates that the types of these parameters do not have to be identical.
The output of the following code is:
The code is as follows:
1
2
One
Both
Aa
One
Both
Aa
1
2
In addition to the Declaration,Running GuestArticles are original, reproduced please link to the form of the address of this article
Implementing a mutable parameter instance in C #
This address: http://www.paobuke.com/develop/c-develop/pbk23166.html
Related content C # using the dir command to implement a file Search feature example of how to add a watermark to excel in C # C # to convert Chinese characters to phonetic abbreviations code C # Get the number of strings after the method
WinForm Dynamic load TabControl Usages example C # to determine if multiple text box input values in a page have a duplicate implementation method C # Design mode example of a single instance mode example of a C # socket operation class instance parsing
Implementing a mutable parameter instance in C #