Files
2nd/10_Wiki/Topic_Programming/Topic_CSharp/CSharp_Strings_Interpol.md
T
Antigravity Agent e9cbf23ab5 docs(10_Wiki): Dev 폴더 누락분 반영 — Topic_Programming으로 통합
이전 재구성 작업에서 Dev/ 폴더가 누락되었던 것을 반영.

- Dev/Topic_Programming(중첩 폴더, 78개)은 Dev 자체 최상위 폴더들
  (Architecture/Conventions/Engineering_Intelligence 등)과 완전 중복이라 제거.
- Dev 최상위 엔지니어링 지식 폴더(Architecture/Conventions/Engineering_Intelligence/
  Failure_Library/Generalized_Principles/Language/Pattern_Catalog/Platform_Guides/
  Subsystems, 77개)는 이미 Topic_Programming/Topic_Programming에 더 최신 버전이
  존재해 중복 제거(고유 콘텐츠 1개는 예외 처리하여 이동 보존).
- Dev의 W3Schools 언어 튜토리얼 폴더(Topic_C/CPP/CSS/CSharp/HOWTO/HTML/Java/
  JavaScript/PHP/Python/SQL/W3CSS, 1201개)는 전부 Topic_Programming 하위로 이동.
- 에이전트 운영 상태(.astra/docs)는 그대로 유지, 콘텐츠 폴더만 정리.
- Topic_Programming 최종 문서 수: 2784 → 3985.
2026-07-05 00:39:13 +09:00

4.2 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-strings-interpol C# String Interpolation Programming_Language draft conceptual
$ string C#
interpolated strings
C# 문자열 보간
B 0.84 2026-07-04 2026-07-04
csharp
programming-language
w3schools
strings
interpolation
https://www.w3schools.com/cs/cs_strings_interpol.php

CSharp String Interpolation

🎯 한 줄 통찰 (One-line insight)

C#'s $"...{var}..." interpolated strings (introduced in C# 6) solve the exact same "embed a variable directly in text without manual concatenation" problem that Python's f-strings (f"...{var}...") already solved in this wiki series — same {} placeholder mechanism, just a $ prefix instead of Python's f prefix — while C++ still has no first-class equivalent (requiring std::format in C++20+ or manual << chaining), making C# the second language in this series (after Python) to bake variable-embedding directly into string literal syntax rather than relying purely on the + operator. [S1]

🧠 핵심 개념 (Core concepts)

  • $ prefix — required to enable string interpolation; without it, {firstName} would just be literal text, not a placeholder. [S1]
  • {variable} placeholders — variable names inside curly braces are substituted with their values directly in the string. [S1]
  • No manual spacing needed — unlike + concatenation (which required manually adding a trailing space inside "John "), interpolation lets you place spaces naturally between placeholders in the template string. [S1]
  • Introduced in C# 6 — a relatively recent addition to the language, not present from C#'s first version. [S1]

📖 세부 내용 (Details)

  • Example: string firstName = "John"; string lastName = "Doe"; string name = $"My full name is: {firstName} {lastName}"; Console.WriteLine(name);"My full name is: John Doe". [S1]

⚖️ 모순 및 업데이트 (Contradictions & updates)

  • Python의 f-string과 동일한 설계 철학: $"...{var}..."{} 플레이스홀더 치환 방식이 이전에 위키화한 Topic_Python의 f-string(f"...{var}...")과 접두사 문자만 다를 뿐 동일한 메커니즘이라는 점이 확인됨 — C++는 이 시리즈에서 아직 이런 1급 문자열 보간 문법을 갖추지 못했음(C++20의 std::format 이전까지는 없었음). [S1]
  • 공백을 수동으로 넣을 필요가 없어짐: String Concatenation 챕터의 + 방식은 "John "처럼 문자열 리터럴 안에 공백을 미리 넣어둬야 했지만, 보간 문자열은 템플릿 안에서 자연스럽게 공백을 배치할 수 있다는 점이 개선점으로 확인됨. [S1]

🛠️ 적용 사례 (Applied in summary)

firstName과 lastName을 $"My full name is: {firstName} {lastName}" 형태로 한 줄에 합쳐 출력하는 예제가 원문에서 직접 실전 활용 사례로 제시됨. [S1]

💻 코드 패턴 (Code patterns)

String interpolation with the $ prefix — no manual spacing needed (C#):

string firstName = "John";
string lastName = "Doe";
string name = $"My full name is: {firstName} {lastName}";
Console.WriteLine(name);  // "My full name is: John Doe"

검증 상태 및 신뢰도

  • 상태: 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# String Interpolation" page (Astra wiki-curation, P-Reinforce v3.1 format).