当前位置:首页 > 开发 > C# > 正文内容

C# 前++,与后++的区别

C#3年前 (2022-11-01)

简单一句话,前++是自身先加1,再运算,后加加是先运算,然后再自身加1

后++    
int a = 5;
Console.WriteLine("a = {0}", a++);
Console.WriteLine("a = {0}", a);

输出

a = 5
a = 6


前++    
int b = 5;
Console.WriteLine("b = {0}", ++b);

输出

b = 6



转载请注明出处。

本文链接:http://pythonopen.com/?id=240

返回列表

上一篇:C# 冒泡排序

下一篇:C# SHA1

相关文章

C# CRC32算法

CRC32      class CRC32...

C#解析Torrent获取磁力链

NuGet添加 MonoTorrentusing MonoTorrent;string&n...

C# 冒泡排序

int[] iage = { 11, 55,&nb...

C# ref 和out

ref关键字概念:ref是 C# 中的一个关键字,用于按引用传递参数。当在方法调用中使用ref关键字...

C# Graphics文本抗锯齿

g.TextRenderingHint = TextRenderingHint....

C# TextRenderer.MeasureText

TextRenderer.MeasureText是System.Windows.Forms命名空间中...