Skip to Content
C# 7.0 核心技术指南(原书第7版)
book

C# 7.0 核心技术指南(原书第7版)

by Joseph Albahari, Ben Albahari
August 2019
Intermediate to advanced
1074 pages
24h 28m
Chinese
China Machine Press
Content preview from C# 7.0 核心技术指南(原书第7版)
C#
语言基础
39
2.4.3 算术运算符
算式运算符(+
-
*/ %)可用于 8 位和 16 的整数类型之外的所有数值
类型:
+ Addition
- Subtraction
* Multiplication
/ Division
% Remainder after division
2.4.4 自增和自减运算符
自增和自减运算符(++--)分别给数值类型 1 或者减 1。具体要将其放在变量之前
还是之后则取决于需要得到变量在自增 / 自减之前的值还是之后的值。例如:
int x = 0, y = 0;
Console.WriteLine (x++); // Outputs 0; x is now 1
Console.WriteLine (++y); // Outputs 1; y is now 1
2.4.5 特殊整数类型运算
(整数类型指 intuintlongulongshortushortbyte sbyte。)
2.4.5.1 整数除法
整数类型的除法运算总是会截断余数( 0 入)。用一个值 0 变量做除数将产生运
行时错误(DivideByZeroException):
int a = 2 / 3; // 0
int b = 0;
int c = 5 / b; // throws DivideByZeroException
用字面量式常量 0 除数将产生编译时错误。
2.4.5.2 整数溢出
在运行时执行整数类型的算术运算可能会造成溢出。默认情况下,溢出会默默地发生 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

算法技术手册(原书第2 版)

算法技术手册(原书第2 版)

George T.Heineman, Gary Pollice, Stanley Selkow
数字化转型:企业破局的34 个锦囊

数字化转型:企业破局的34 个锦囊

Gary O’Brien, Xiao Guo, Mike Mason

Publisher Resources

ISBN: 9787111631347