Implementing a mutable parameter instance in C #

Source: Internet
Author: User

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 #

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.