---
id: csharp-data-types
title: "C# Data Types"
category: "Programming_Language"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["int long float double bool char string sizes", "C# 데이터 타입"]
duplicate_of: ""
source_trust_level: "B"
confidence_score: 0.86
created_at: 2026-07-04
updated_at: 2026-07-04
review_reason: ""
merge_history: []
tags: ["csharp", "programming-language", "w3schools", "data-types"]
raw_sources: ["https://www.w3schools.com/cs/cs_data_types.php"]
applied_in: []
github_commit: ""
---

# [[CSharp Data Types]]

## 🎯 한 줄 통찰 (One-line insight)
C# fixes its numeric type SIZES in the language spec itself (`int` = 4 bytes, `long` = 8 bytes, always, on every platform), unlike C where `int`/`long` sizes are implementation-defined and vary by compiler/platform (a recurring caveat throughout Topic_C's Data Types chapter) — trading C's "your mileage may vary" portability model for C#'s "the number never changes" guarantee, a direct consequence of C# always running on a single controlled runtime (.NET/CLR) rather than being compiled to arbitrary native targets. [S1]

## 🧠 핵심 개념 (Core concepts)
- **Numeric types split into integer vs. floating-point** — integer types (`int`, `long`) store whole numbers; floating-point types (`float`, `double`) store fractional numbers. [S1]
- **Fixed sizes** — `int` 4 bytes (-2,147,483,648 to 2,147,483,647), `long` 8 bytes (much larger range), `float` 4 bytes (~6-7 decimal digit precision), `double` 8 bytes (~15 decimal digit precision), `bool` 1 byte, `char` 2 bytes, `string` 2 bytes per character. [S1]
- **Literal suffixes required** — `long` values need an `L` suffix (`15000000000L`), `float` values need `F` (`5.75F`), `double` values need `D` (`19.99D`) — the compiler needs the suffix to disambiguate which type the literal should be. [S1]
- **float vs. double precision trade-off** — float's ~6-7 digit precision vs. double's ~15 digits is the explicit reason the tutorial recommends double for "most calculations." [S1]
- **Scientific notation** — `float f1 = 35e3F; double d1 = 12E4D;` — the `e`/`E` indicates a power of 10. [S1]
- **`int` and `double` as the default go-to types** — despite the full menu of numeric types, the tutorial states int (whole numbers) and double (decimals) are the most commonly used throughout. [S1]

## 📖 세부 내용 (Details)
- Boolean: `bool isCSharpFun = true; bool isFishTasty = false;` — printed values are capitalized `True`/`False` (not lowercase `true`/`false`) in console output. [S1]
- Char: `char myGrade = 'B';` — single quotes only. [S1]
- String: `string greeting = "Hello World";` — double quotes only. [S1]

## ⚖️ 모순 및 업데이트 (Contradictions & updates)
- **타입 크기가 플랫폼에 관계없이 고정됨**: Topic_C의 Data Types 챕터는 int/long 등의 정확한 크기가 컴파일러/플랫폼마다 다를 수 있다는 점을 반복적으로 경고했지만, C#은 int=4바이트, long=8바이트 등으로 크기를 언어 명세 차원에서 고정한다는 점이 이번 챕터에서 확인됨 — .NET/CLR이라는 단일 통제된 런타임 위에서만 실행되기 때문에 가능한 보장. [S1]
- **불리언 출력이 대문자로 표시됨**: `Console.WriteLine(isCSharpFun);`이 `True`(대문자 T)를 출력한다는 점이 확인됨 — C/C++가 0/1을 출력하거나 소문자 true/false를 요구하는 것과는 다른 표시 방식. [S1]

## 🛠️ 적용 사례 (Applied in summary)
현재 발견된 실제 적용 사례가 없습니다 — 7가지 데이터 타입 각각을 선언하고 출력하는 예제가 원문에서 개별적으로 제시됨. [S1]

## 💻 코드 패턴 (Code patterns)
Literal suffixes required for long/float/double (C#):
```csharp
int myInt = 100000;
long myLong = 15000000000L;   // L suffix required
float myFloat = 5.75F;        // F suffix required
double myDouble = 19.99D;     // D suffix required
bool isCSharpFun = true;      // prints "True"
char myGrade = 'B';
string greeting = "Hello World";
```

## ✅ 검증 상태 및 신뢰도
- **상태:** draft
- **검증 단계:** conceptual
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
- **신뢰 점수:** 0.86
- **중복 검사 결과:** 신규 생성 (New discovery)

## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[C# Tutorial]]
- **관련 개념:** [[CSharp Variables]], [[CSharp Type Casting]], [[C Data Types]]
- **참조 맥락:** Data Types & Type Casting 섹션 — Type Casting 챕터로 이어짐.

## 📚 출처 (Sources)
- [S1] W3Schools — C# Data Types — https://www.w3schools.com/cs/cs_data_types.php

## 📝 변경 이력 (Change history)
- 2026-07-04: Initial draft synthesized from the W3Schools "C# Data Types" page (Astra wiki-curation, P-Reinforce v3.1 format).
