Your digital city is taking shape, but before a single wall goes up, the .NET Architect must crunch the numbers. How many bricks? What's the cost? Can the foundation handle the load? C# gives you a rich toolkit of numeric types — each one tuned for a different job, like choosing the right measuring tape for the task.
Think of these as different-sized containers on your workshop shelf:
byte (0 to 255) — Tiny counter, like tracking paint cans in a room.short (-32,768 to 32,767) — Small numbers, like bolts per beam.int (-2.1B to 2.1B) — The everyday workhorse. Floor counts, brick totals, IDs.long (±9.2 quintillion) — Massive numbers, like grains of sand on a beach. Suffix: L.float (~7 digits precision) — Quick-and-dirty decimals. Suffix: f.double (~15 digits precision) — The default decimal type. Scientific calculations, measurements.decimal (~28 digits precision) — Money and finance. Never use double for currency! Suffix: m.C# supports all the classic math operations. The one that surprises newcomers is integer division — dividing two int values drops the decimal part entirely.
For anything beyond basic arithmetic, the Math class is your engineering calculator:
7 / 2 gives 3, not 3.5! To get a decimal result, at least one operand must be a decimal type: 7.0 / 2 gives 3.5. And never use double for money — 0.1 + 0.2 might not equal 0.3 due to floating-point quirks. Use decimal instead.