--- id: csharp-output title: "C# Output" category: "Programming_Language" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["Console.WriteLine", "Console.Write", "C# 좜λ ₯"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.85 created_at: 2026-07-04 updated_at: 2026-07-04 review_reason: "" merge_history: [] tags: ["csharp", "programming-language", "w3schools", "output"] raw_sources: ["https://www.w3schools.com/cs/cs_output.php"] applied_in: [] github_commit: "" --- # [[CSharp Output]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) C# splits what C's single `printf` handled into two separate methods differentiated ONLY by whether a trailing newline is added β€” `WriteLine()` (adds newline) vs. `Write()` (doesn't) β€” the same two-method split C++ never needed because `cout <<` never auto-newlines (you always add `"\n"` explicitly), meaning C# occupies a middle ground: less manual than C++'s explicit-newline-every-time model, but still requires picking the right method name up front rather than composing newlines as data. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **`Console.WriteLine()`** β€” outputs text/values AND appends a new line after each call. [S1] - **`Console.Write()`** β€” outputs text/values WITHOUT appending a new line; consecutive `Write()` calls print on the same line. [S1] - **Numeric output & inline math** β€” `Console.WriteLine(3 + 3);` performs the calculation and prints the result directly, no string conversion needed. [S1] - **Tutorial convention** β€” the W3Schools C# series uses `WriteLine()` exclusively going forward, specifically because it makes output easier to read chapter-to-chapter. [S1] - **Manual spacing with `Write()`** β€” since `Write()` never inserts anything, an extra trailing space must be added manually inside the string when concatenating consecutive `Write()` outputs for readability. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - Multiple `WriteLine()` calls each produce their own line: `Console.WriteLine("Hello World!"); Console.WriteLine("I am Learning C#"); Console.WriteLine("It is awesome!");`. [S1] - `Write()` chaining on one line: `Console.Write("Hello World! "); Console.Write("I will print on the same line.");` β€” note the manual trailing space in the first string. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) - **μ€„λ°”κΏˆ μ—¬λΆ€λ‘œ λ©”μ„œλ“œ μžμ²΄κ°€ 뢄리됨**: C++의 `cout <<`λŠ” μ€„λ°”κΏˆμ„ μ ˆλŒ€ μžλ™μœΌλ‘œ λ„£μ§€ μ•Šκ³  항상 `"\n"`을 λͺ…μ‹œμ μœΌλ‘œ λΆ™μ—¬μ•Ό ν–ˆμ§€λ§Œ, C#은 μ•„μ˜ˆ WriteLine()/Write() 두 개의 λ‹€λ₯Έ λ©”μ„œλ“œλ‘œ λ‚˜λˆ  μ€„λ°”κΏˆ μžλ™ μ‚½μž… μ—¬λΆ€λ₯Ό λ©”μ„œλ“œ 선택 μ‹œμ μ— κ²°μ •ν•œλ‹€λŠ” 점이 확인됨 β€” C의 printf ν•˜λ‚˜λ‘œ μ²˜λ¦¬ν•˜λ˜ 것을 두 λ©”μ„œλ“œλ‘œ λΆ„λ¦¬ν•œ 것. [S1] ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” μ—¬λŸ¬ 쀄 좜λ ₯κ³Ό 같은 쀄 좜λ ₯을 λΉ„κ΅ν•˜λŠ” μ˜ˆμ œκ°€ μ›λ¬Έμ—μ„œ μ œμ‹œλ¨. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) WriteLine vs Write β€” the only difference is the trailing newline (C#): ```csharp Console.WriteLine("Hello World!"); // newline added automatically Console.WriteLine(3 + 3); // prints 6 Console.Write("Hello World! "); // no newline -- manual space added Console.Write("I will print on the same line."); ``` ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.85 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[C# Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[CSharp Syntax]], [[CSharp Comments]], [[CPP Output]] - **μ°Έμ‘° λ§₯락:** Basics μ„Ήμ…˜ β€” Comments μ±•ν„°λ‘œ 이어짐. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” C# Output β€” https://www.w3schools.com/cs/cs_output.php ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "C# Output" page (Astra wiki-curation, P-Reinforce v3.1 format).