15.02.2015 Views

C# 4 and .NET 4

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

operators ❘ 153<br />

arithmetic operator. This returns the remainder after division, so, for example, x % 5 returns 2 if x is<br />

equal to 7.<br />

You will use few pointers in <strong>C#</strong>, <strong>and</strong>, therefore, few indirection operators. More specifically, the only<br />

place you will use them is within blocks of unsafe code, because that is the only place in <strong>C#</strong> where pointers<br />

are allowed. Pointers <strong>and</strong> unsafe code are discussed in Chapter 13.<br />

operator shortcuts<br />

The following table shows the full list of shortcut assignment operators available in <strong>C#</strong>.<br />

shorTCuT oPeraTor<br />

equiValenT To<br />

x++, ++x x = x + 1<br />

x--, --x x = x – 1<br />

x += y<br />

x -= y<br />

x *= y<br />

x /= y<br />

x %= y<br />

x >>= y<br />

x y<br />

x = x

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!