Files
2nd/10_Wiki/Dev/Topic_CSharp/CSharp_Variables_Display.md
T
Antigravity Agent 1cfd3bbb56 docs(10_Wiki): 위키 구조 정리 — 언어 튜토리얼 카테고리 폴더 제거 + 신규 자산 동기화
Topic_CSS/Topic_HTML/Topic_JavaScript/Topic_Prompt/Topic_Comfyui 등 기존 카테고리 폴더를 정리하고,
Topic_Graphic/Dev 등 신규 산출물과 Topics 내부 세션/메모리 기록을 동기화.
2026-07-05 00:10:59 +09:00

4.0 KiB

id, title, category, status, verification_status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, created_at, updated_at, review_reason, merge_history, tags, raw_sources, applied_in, github_commit
id title category status verification_status canonical_id aliases duplicate_of source_trust_level confidence_score created_at updated_at review_reason merge_history tags raw_sources applied_in github_commit
csharp-variables-display C# Display Variables Programming_Language draft conceptual
string concatenation C#
+ operator overload C#
C# 변수 출력
B 0.84 2026-07-04 2026-07-04
csharp
programming-language
w3schools
variables
concatenation
https://www.w3schools.com/cs/cs_variables_display.php

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 combinationfirstName + 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#):

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)

📚 출처 (Sources)

📝 변경 이력 (Change history)

  • 2026-07-04: Initial draft synthesized from the W3Schools "C# Display Variables" page (Astra wiki-curation, P-Reinforce v3.1 format).