C # Boxing and unpacking

Source: Internet
Author: User

I understand the boxes and unpacking.

Boxing: When a value type is converted to a reference type, an additional allocation reference pointer to the values type and returns it back to the reference type is called boxing. Assigning a pointer like a box converts a value type into a reference type. So it's called boxing.

Unpacking: Contrary to boxing. When a reference type is converted to a value type, ignoring the value type directly returns the value type called unboxing.

In my understanding, unpacking is less resource-intensive.

However, there is a unpacking and boxing required additional new open objects and pointers need to consume resources, so overall, the resource is consumed when unpacking.

C # Boxing and unpacking

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.