11.1 Value types

王朝other·作者佚名  2006-01-10
窄屏简体版  字體: |||超大  

11.1 Value types

A value type is either a struct type or an enumeration type. C# provides a

set of predefined struct types

called the simple types. The simple types are identified through reserved

words.

value-type:

struct-type

enum-type

struct-type:

type-name

simple-type

simple-type:

numeric-type

bool

numeric-type:

integral-type

floating-point-type

decimal

integral-type:

sbyte

byte

short

ushort

int

uint

long

ulong

char

C# LANGUAGE SPECIFICATION

90

floating-point-type:

float

double

enum-type:

type-name

All value types implicitly inherit from class object. It is not possible

for any type to derive from a value

type, and value types are thus implicitly sealed (§17.1.1.2).

A variable of a value type always contains a value of that type. Unlike

reference types, it is not possible for

a value of a value type to be null, or to reference an object of a more

derived type.

Assignment to a variable of a value type creates a copy of the value being

assigned. This differs from

assignment to a variable of a reference type, which copies the reference

but not the object identified by the

reference.

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有  導航