--- id: csharp-variables-display title: "C# Display Variables" category: "Programming_Language" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["string concatenation C#", "+ operator overload C#", "C# λ³€μˆ˜ 좜λ ₯"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.84 created_at: 2026-07-04 updated_at: 2026-07-04 review_reason: "" merge_history: [] tags: ["csharp", "programming-language", "w3schools", "variables", "concatenation"] raw_sources: ["https://www.w3schools.com/cs/cs_variables_display.php"] applied_in: [] github_commit: "" --- # [[CSharp Display Variables]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) C# overloads the SAME `+` operator to mean two entirely different operations depending on operand type β€” string concatenation (`"Hello " + name`) versus numeric addition (`x + y`) β€” with no separate concatenation operator like C++ chose to avoid (C++ ALSO overloads `<<` for output but keeps `+` mostly numeric for its native strings, relying on `std::string`'s own `+` overload); C# instead makes this dual-meaning `+` a first-class, chapter-one-visible feature, closer to Java's identical `+`-for-both-jobs design than to C++'s more type-segregated approach. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **`+` for string + text combination** β€” `"Hello " + name` concatenates a string literal and a string variable. [S1] - **`+` for string + string combination** β€” `firstName + lastName` concatenates two string variables into a new string. [S1] - **`+` for numeric addition** β€” when both operands are numeric (e.g. `int`), `+` performs mathematical addition instead of concatenation. [S1] - **Type determines behavior** β€” the SAME operator symbol resolves to concatenation or addition purely based on the operand types involved. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - String + variable: `string name = "John"; Console.WriteLine("Hello " + name);`. [S1] - Variable + variable (string): `string firstName = "John "; string lastName = "Doe"; string fullName = firstName + lastName; Console.WriteLine(fullName);`. [S1] - Numeric addition: `int x = 5; int y = 6; Console.WriteLine(x + y); // Print the value of x + y` β†’ outputs `11`. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) - **동일 μ—°μ‚°μžκ°€ νƒ€μž…μ— 따라 μ™„μ „νžˆ λ‹€λ₯Έ λ™μž‘μ„ 함**: `+`κ°€ λ¬Έμžμ—΄μ΄λ©΄ μ—°κ²°(concatenation), 숫자면 μ‚°μˆ  λ§μ…ˆμ΄λΌλŠ” 이쀑 역할을 ν•œλ‹€λŠ” 점이 이번 μ±•ν„°μ—μ„œ 확인됨 β€” Java와 λ™μΌν•œ 섀계이며, C++κ°€ `std::string`의 `+` μ—°μ‚°μž μ˜€λ²„λ‘œλ“œλ₯Ό 톡해 μœ μ‚¬ν•˜κ²Œ λ™μž‘ν•˜μ§€λ§Œ C#은 이λ₯Ό λ³€μˆ˜ 좜λ ₯ 챕터 μ΄ˆλ°˜λΆ€ν„° λͺ…μ‹œμ μœΌλ‘œ κ°•μ‘°ν•œλ‹€λŠ” 차이가 있음. [S1] ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” 이름 λ¬Έμžμ—΄μ„ 인사말과 μ—°κ²°ν•˜κ³ , 숫자 두 개λ₯Ό 더해 좜λ ₯ν•˜λŠ” 두 μ˜ˆμ œκ°€ μ›λ¬Έμ—μ„œ λ‚˜λž€νžˆ μ œμ‹œλ¨. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) The `+` operator's dual meaning β€” concatenation vs. addition (C#): ```csharp string name = "John"; Console.WriteLine("Hello " + name); // concatenation -> "Hello John" int x = 5; int y = 6; Console.WriteLine(x + y); // addition -> 11 ``` ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.84 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[C# Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[CSharp Variables Constants]], [[CSharp Variables Multiple]], [[CSharp Strings Concat]] - **μ°Έμ‘° λ§₯락:** Variables μ„Ήμ…˜ β€” Multiple Variables μ±•ν„°λ‘œ 이어짐. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” C# Display Variables β€” https://www.w3schools.com/cs/cs_variables_display.php ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "C# Display Variables" page (Astra wiki-curation, P-Reinforce v3.1 format).