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
About three keywords in C # params,ref,outc# download the Web page and output the method in the console C # set the boot entry, cancel the boot entry in detail the generic covariance (covariant) and the inversion (contravariant) in. NET 4.0
C # message time formatting C # using GDI to draw straight lines methods of intercepting function of C # string summarize C # method for generating code128 barcodes
Implementing a mutable parameter instance in C #