C# ValueTypes
【C# ValueTypes】
1、哪些类型是ValueType?
The value types consist of two main categories:
Structs fall into these categories:
Numeric types
User defined structs.
2、内置C#值类型实际是C#内置类的alias。例如:
3、The C# type keywords and their aliases are interchangeable.
4、以下2种初始化的是,一个会调用构造函数初始化,一个不会。
int myInt;
myInt = new int(); // Invoke default constructor for int type.
5、Data types are separated into value types and reference types. Value types are either stack-allocated or allocated inline in a structure. Reference types are heap-allocated. Both reference and value types are derived from the ultimate base class Object. In cases where it is necessary for a value type to behave like an object, a wrapper that makes the value type look like a reference object is allocated on the heap, and the value type's value is copied into it. The wrapper is marked so the system knows that it contains a value type. This process is known as boxing, and the reverse process is known as unboxing. Boxing and unboxing allow any type to be treated as an object.
Although ValueType is the implicit base class for value types, you cannot create a class that inherits from ValueType directly. Instead, individual compilers provide a language keyword or construct (such as struct in C# and Structure…End Structure in Visual Basic) to support the creation of value types.
参考:
1、http://msdn.microsoft.com/zh-cn/library/ya5y69ds.aspx
2、http://msdn.microsoft.com/zh-cn/library/s1ax56ch.aspx
3、http://msdn.microsoft.com/zh-cn/library/system.valuetype(v=vs.110).aspx
C# ValueTypes的更多相关文章
- [NHibernate]Parent/Child
系列文章 [Nhibernate]体系结构 [NHibernate]ISessionFactory配置 [NHibernate]持久化类(Persistent Classes) [NHibernate ...
- 开源库Magicodes.ECharts使用教程
目录 1 概要 2 2 Magicodes.ECharts工作原理 3 2.1 架构说明 3 2.1.1 Axis 4 2.1.2 CommonD ...
- (C#) Interview Questions.
(Note: Most are collected from Internet. 绝大部分内容来自互联网) 1. What's the difference between Hashtable and ...
- C#EXCEL 操作类--C#DataToExcel帮助类
using System; using System.Diagnostics; //using Excel; namespace DotNet.Utilities { /// <summ ...
- NHibernate讲解
第1章 NHibernate体系结构 总览 对NHibernate体系结构的非常高层的概览: 这幅图展示了NHibernate使用数据库和配置文件数据来为应用程序提供持久化服务(和持久化的对象). 我 ...
- Effective C# Chapter1-Language Elements
<EffectiveC#>这本书讲了一些关于C#语言的使用技巧和经验. 该系列文章是备忘录和自己的一些见解.程序猿们最喜欢这类问题了,欢迎讨论~ 菜单 Item 1 使用属性取代公共成员变 ...
- [Excel] C#DataToExcel帮助类 (转载)
点击下载 DataToExcel.rar 看下面代码吧 /// <summary> /// 类说明:DataToExcel /// 编 码 人:苏飞 /// 联系方式:361983679 ...
- CART剪枝
与上篇文章中提到的ID3算法和C4.5算法类似,CART算法也是一种决策树分类算法.CART分类回归树算法的本质也是对数据进行分类的,最终数据的表现形式也是以树形的模式展现的,CART与ID3,C4. ...
- ASP.NET导出EXCEl方法使用COM.EXCEL不使用EXCEl对象
第一种:导出gridVIEW中的数据,用hansTABLE做离线表,将数据库中指定表中的所有数据按GRIDVIEW中绑定的ID导出 只能导出数据不能去操作相应的EXCEl表格,不能对EXCEL中的数据 ...
随机推荐
- Linux安装vsftpd总结
我使用的是CentOS6安装的vsftpd,转载请注明出处,以下是我的记录: #查看是否已经安装了vsfptd vsftpd -v #安装 yum -y install vsftpd #创建:chro ...
- python第三方库
autopy autopy是一个自动化操作的python库,可以模拟一些鼠标.键盘事件,还能对屏幕进行访问 pywin32 win32api的python封装 PIL python的图形图像处理框架
- centos6.5 ifconfig没有ipv4地址
进入/etc/sysconfig/network-scripts/目录中,可以看到ifcfg-eth0文件, vi ifcfg-eth0编辑文件, 将“ONBOOT=no” 选项改成“ONBOOT=y ...
- asp搭建网站
测试环境:Windows 2003 下载asp源码导入 C:\Inetpub\wwwroot ###一.通过ip访问 最后浏览 浏览器输入ip或者 http://127.0.0.1 二.通过域名访问 ...
- ArangoDB Foxx service 使用
备注: 项目使用的是github https://github.com/arangodb-foxx/demo-hello-foxx 1. git clone git clone https://g ...
- WinForm 窗体初始位置篇
1.在C#中,From本身有个StartPosition属性可以控制居中显示. StartPosition 默认值是WindowsDefaultLocation ,我们只需要改成CenterScree ...
- 使用php生成数字、字母组合验证码(一)
项目中经常会遇到一些登陆验证,支付验证等等一系列安全验证的策略.实现方法多种多样,下面就来讲解下如何用php生成简单的文字+数字组合的验证码: 所用语言php,gd库 原理解释: a>实质上是在 ...
- stm32f0系列在SWD模式下载时复位失败
用stm32f030K6T6做了个小玩意,仿真电路就直接把3.3V,SWDIO,SWCLK,GND引出来连接到j-link的这四个角上,SWDIO和SWCLK引脚既没有上拉也没有下拉. MCU ...
- centos7下安装Anaconda3
下载anaconda3: wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-4.2.0-Linux-x86_64 ...
- 老齐python-基础9(函数)
继续上篇 函数 多参数: >>> def foo(x,y,z,*args,**kargs): ... print(x) ... print(y) ... print(z) ... p ...