Drill down into C # data types

Source: Internet
Author: User

I. Value types and reference types

1. Value types: References to reference types for all value types and reference types are stored on the stack

Value type Assignment principle: The true value copied on the stack

2. Reference type:

1> properties of real objects stored on the heap on the real object itself

2> heap on open space storage data

the memory address on the 3> heap is stored in the stack space

4> from the stack to the real object on the heap

Two. Structure

1. Method 5 Elements

1> return value type

2> access Modifiers

3> Method Name

4> method Body

5> Method Parameters

2. Use of structures

1> can be used without a new direct definition of the structure of the object

2> declaration must assign an initial value to a member of a struct

Three. Crating and unpacking

Four. Different types of parameter passing

1> when a value type parameter is passed using value mode (without ref decoration), the modification of the parameter in the method does not persist

2> when a reference type parameter is passed using a value method (without ref decoration), the modification of the parameter in the method is preserved

3> when a value type is passed by reference (without ref decoration) or when a reference type parameter is passed, the modification of the parameter in the method is preserved

Drill down into C # data types

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.