. NET basic step by step: [out, ref, params],. netoutrefparams

Source: Internet
Author: User

. NET basic step by step: [out, ref, params],. netoutrefparams

Out,Ref,Params

Out:

If you return multiple values of the same type in a method, you can consider returning an array.

However, if multiple different types of values are returned, the returned array will not work. At this time,

We can consider using the out parameter.

OutParameters focus on returning multiple different types of values in a method. ParametersInitialization must be completed in the Method

 

Case:

 

 

Ref:

A variable can be brought into a method for change. After the change is completed, the changed value is taken out of the method.

RefThe parameter must be assigned a value outside the method, but not in the method.

 

Case:

 

 

Params;

The elements in the real parameter list that are consistent with the variable parameter array are processed as elements of the array.

ParamsA variable parameter must be the last element in the parameter list.

Case:

 

 

Well, this article is here, and the case provided in this article is only, there is no running result, please handle it yourself. I hope it will help beginners. I also hope that the great gods will take us with us, pack us with force, and fly us with us...

Finally, make a small advertisement: QQ group:. NET Step by stepGroup Number:590170361(Add group remarks: what you see in the blog Park)

 

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.