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中的数据 ...
随机推荐
- LeetCode 424. Longest Repeating Character Replacement
原题链接在这里:https://leetcode.com/problems/longest-repeating-character-replacement/description/ 题目: Given ...
- grpc 安装以及墙的解决方法
1. 默认官方文档 go get -u google.golang.org/grpc 因墙的问题,大部分安装是无法完成的 2. 解决方法 a. grpc mkdir -p $GOAPTH/src/go ...
- kong nginx 配置文件说明&&借鉴
备注: 只是简单的进行说明配置文件,不会牵扯到源码 1. 配置文件位置 // 通过ps 查找 ps -ef |grep nginx /usr/local/openresty/nginx/ ...
- #231-D: declaration is not visible outside of function
通常出现在.h中的函数声明,函数声明中的变量用到了.h当中没有的变量形式,比如特殊定义的结构体
- 虚拟路由冗余协议VRRP
一.VRRP简介 虚拟路由冗余协议VRRP(Virtual Router Redundancy Protocol)通过把几台路由设备联合组成一台虚拟的路由设备,将虚拟路由设备的IP地址作为用户的默认网 ...
- oracle的时间
今天发现之前从oracle导出的数据时间格式很奇怪: "ACTIVETIME","ACTIVITYID" "2018-08-10 06:08:43&q ...
- coding 绑定腾讯云开放平台注意事项
coding升级后需要绑定腾讯云开放平台,按照coding文档的提示操作就好 1.创建腾讯云平台后,不要自定义邮箱和用户名 2.直接绑定原来我们使用的coding账号即可 绑定成功后,邮箱和用户名会自 ...
- oracle版本及字符集查询
查询oracle版本:select * from v$version; 查询oracle字符集:select * from nls_database_parameters;
- struts2学习(4)struts2核心知识III
一.result配置: result - name 就是前面返回的值,success,error等. type: dispatcher. 默认是这个,底层是jsp的forward: redirect: ...
- centos如何使用utc时间
1.将本地时间文件改名,做备份文件为localtime2 mv /etc/localtime /etc/localtime2 2.将UTC文件和本地文件做连接ln -s /usr/share/zone ...