What is the difference between a reference type and a value type in C #, respectively?

Source: Internet
Author: User
The value types of C # include: struct (numeric type, bool type, user-defined struct), enumeration, nullable type. The reference types of C # include: arrays, user-defined classes, interfaces, delegates, object, strings. The elements of an array, whether they are reference types or value types, are stored on the managed heap. A reference type stores a reference in the stack whose actual storage location is in the managed heap. For convenience, this article is referred to as a reference type deployed on a managed push. A value type is always assigned where it is declared: as a field, it is stored as a variable (instance) to which it belongs, and is stored on the stack as a local variable. Value types are more efficient in memory management and do not support polymorphism, and are suitable as vectors for storing data; reference types support polymorphism and are suitable for defining the behavior of an application.

The difference, please see http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html

What is the difference between a reference type and a value type in C #, respectively?

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.