C# 中拆箱是什么?
装箱是隐式的,拆箱是显式的。拆箱是指将通过装箱创建的引用类型显式转换回值类型。
让我们看一个 C# 中变量和对象示例:−
// int int x = 30; // Boxing object obj = x; // Un boxing int unboxInt = (int) obj;
以下是拆箱示例:−
int x = 5; ArrayList arrList = new ArrayList(); // Boxing arrList.Add(x); // UnBoxing int y = (int) arrList [0];
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP