2012年2月23日

小典故:为什么数组的索引总是从0开始,而不是1?

摘要: 今天在看Programming C#4.0突然发现了一个典故,挺有意思,发上来分享一下:C-family languages tend to number things from zero, and C# follows suit. This may seem a little idiosyncratic, but it makes sense to the computer. You can think of it as saying how far into the array you want to look. If you want to look at the thing right 阅读全文

posted @ 2012-02-23 09:11 胡茂晓 阅读(581) 评论(0) 推荐(0) 编辑

双加号(++)在C#中的用法解释

摘要: 相信很多朋友对++和--并不陌生,但对他们的用法就比较纠结了,虽然平时Code没有出什么问题,但是总也不放心,下面我来简洁的说一下这个“小”问题。比如:如果lapCount和currentLap都为3,那么执行下面这一句话之后:currenLap=lapCount++;currentLap还是3,而lapCount就是4了。相反:currenLap=++lapCount;currentLap和lapCount就都是4了。 阅读全文

posted @ 2012-02-23 08:43 胡茂晓 阅读(864) 评论(0) 推荐(0) 编辑

导航