8.2.1 Predefined types

8.2.1 Predefined types
C# provides a set of predefined types, most of which will be familiar to C
and C++ developers.
The predefined reference types are object and string. The type object is
the ultimate base type of all
other types. The type string is used to represent Unicode string values.
Values of type string are
immutable.
The predefined value types include signed and unsigned integral types,
floating-point types, and the types
bool, char, and decimal. The signed integral types are sbyte, short, int,
and long; the unsigned
integral types are byte, ushort, uint, and ulong; and the floating-point
types are float and double.
The bool type is used to represent boolean values: values that are either
true or false. The inclusion of bool
makes it easier to write self-documenting code, and also helps eliminate
the all-too-common C++ coding
error in which a developer mistakenly uses .=. when .==. should have been
used. In C#, the example
int i = .;
F(i);
if (i = 0) // Bug: the test should be (i == 0)
G();
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值