C # Study Notes

Source: Internet
Author: User

1. c # nested block and variable declaration Problems

Declare the variable a1 outside the nested block, and declare the variable a2 in the nested block.

In c #, no matter the nesting level, another local variable with the same name cannot be declared within the effective range of a name.

 

2. Reference parameters of method parameters

The ref modifier is used for both declaration and call.

The real parameter must be a variable.


3. Parameter array of method parameters

A parameter list can contain only one parameter array.

If yes, it must be the last parameter.

Use the params Modifier

 

4. method call: provides real parameters in two ways

Provide real parameters of the specified type with commas (,).

Array of elements of this data type

 

5. Sealing
Can only be used as an independent class

Cannot be used as a base class

Use the sealed Modifier

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.