当前位置:网站首页>C # learning 1: value type and reference type
C # learning 1: value type and reference type
2022-06-29 15:46:00 【This is Zhao】
One .C# Common value types and reference types in
1. Value type :
- All numeric types
- character Char type
- bool type
- Structure Struct
- enumeration enum
1. Reference type :
- class
- Array
- entrust
- Interface
- string character string
Two . Difference between value type and reference type
- Reference types allocate memory in the heap , Value types allocate memory on the stack
- Assigning a variable of a reference type to a variable of another reference type only copies the memory address , Value types are copied field by field
- Memory reclamation for reference types is handled by GC Recycling , The memory of the value type will be at the end of the scope , Automatic release
- Reference types inherit from System.Object, Value types inherit from System.ValueType( Be careful : and System. ValueType
And inherit from System.Object)
3、 ... and . Instances of value types and reference types in memory
1. Value type instance in memory : Use structure to illustrate 
2. Instance in reference type memory : Use classes to describe

Four . Value types and reference types copy instances in code
Value type copy instance :
Reference type copy instance :
边栏推荐
- Polarimetric SAR surface classification
- 我想知道我在南宁,到哪里开户比较好?另外,手机开户安全么?
- Informatics Olympiad all in one 2061: trapezoidal area
- Dynamically listening for DOM element height changes
- Bash summary online log
- What is the time complexity of the redis command?? (the actual question is about the underlying structure of redis)
- 高分三号卫星(GF-3)简介
- C SQLite class library
- GWD: rotating target detection based on Gaussian Wasserstein distance | ICML 2021
- swift JSONSerialization
猜你喜欢

MCS: discrete random variable - Hyper geometric distribution

PostgreSQL source code learning (23) -- transaction log ④ - log assembly

在shop工程中,实现一个菜单(增删改查)

14.IP协议-bite

Motion capture system for apple picking robot

Basic composition of radar

MCS: discrete random variable Pascal Distribution

Excel中构建SQL语句

File common tool class, stream related application (record)

postgresql源码学习(24)—— 事务日志⑤-日志写入WAL Buffer
随机推荐
LeetCode-234-回文链表
Summary of recent work
PostgreSQL source code learning (24) -- transaction log ⑤ - log writing to wal buffer
微信公告号自动回复使用图灵机器人实现智能回复
radar transmitter
MCS: discrete random variable - binomial distribution
GWD:基于高斯Wasserstein距离的旋转目标检测 | ICML 2021
Complex convolutional neural network: cv-cnn
Building SQL statements in Excel
MySQL 数据库命名规范.PDF
Informatics Olympiad all in one 1002: output the second integer
Informatics Olympiad all in one 2061: trapezoidal area
Alibaba cloud experience Award: use polardb-x and Flink to build a large real-time data screen
分页sql(rownum、row_number、dense_rank、rank)
Mingdeyang xilinx-k7-325t/410t core board data manual
阿里云体验有奖:使用PolarDB-X与Flink搭建实时数据大屏
Flink SQL任务TaskManager内存设置
SSL v** technical principle
Rust Basics
el-table-column行按钮防重控制loading