C # Functions

Source: Internet
Author: User

1. Define and use functions

A function is a method, code block function names that can be executed in any part of the application are generally written in the form of PascalCasing. The Void keyword indicates that the function has no return value. 2. The return value is Static <returnType> <functionName> (){.... Return <returnValue >;} 3. Static <returnType> <functionName> (<paramType> <paramName> ,....) {.... Return <returnValue>} each parameter has a type and a name separated by commas. 1. Parameter Matching when calling a parameter, the parameter must be exactly the same as the parameter specified in the function definition. 2. The parameter array C # allows you to specify one (only one) for the function) A specific parameter. This parameter must be the last parameter in the function definition. It is called a parameter array and is defined by the keyword params. 3. the reference parameter and value parameter use the ref keyword to specify the variables that the reference parameter uses as the ref parameter has two restrictions: 1. variables must be used in function calls. 2. initialized variables must be used.

Related Article

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.