docs(10_Wiki): 위키 구조 정리 — 언어 튜토리얼 카테고리 폴더 제거 + 신규 자산 동기화

Topic_CSS/Topic_HTML/Topic_JavaScript/Topic_Prompt/Topic_Comfyui 등 기존 카테고리 폴더를 정리하고,
Topic_Graphic/Dev 등 신규 산출물과 Topics 내부 세션/메모리 기록을 동기화.
This commit is contained in:
Antigravity Agent
2026-07-05 00:10:59 +09:00
parent a397bc4720
commit 1cfd3bbb56
1495 changed files with 68534 additions and 27 deletions
@@ -0,0 +1,85 @@
---
id: csharp-properties
title: "C# Properties (Get and Set)"
category: "Programming_Language"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["get set C#", "automatic properties C#", "encapsulation C#", "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", "oop", "properties", "encapsulation"]
raw_sources: ["https://www.w3schools.com/cs/cs_properties.php"]
applied_in: []
github_commit: ""
---
# [[CSharp Properties]]
## 🎯 한 줄 통찰 (One-line insight)
This is the chapter where the `.Length`-is-a-property-not-a-method observation from way back in the Strings chapter finally gets explained: a C# property is a LANGUAGE-LEVEL construct combining a private field with `get`/`set` accessor blocks, and — unlike C++, which has no native property syntax and requires programmers to write plain `getName()`/`setName()` METHODS by convention — C# additionally offers "automatic properties" (`public string Name { get; set; }`) that need no backing field written at all, making encapsulation nearly free syntactically where C++ makes it entirely manual boilerplate. [S1]
## 🧠 핵심 개념 (Core concepts)
- **Encapsulation** — hiding sensitive data by declaring fields `private`, then exposing controlled access through `public` get/set methods via properties. [S1]
- **Property** — a hybrid of a variable and a method, containing a `get` accessor and a `set` accessor. [S1]
- **`get` accessor** — returns the value of the associated private field. [S1]
- **`set` accessor** — assigns a value to the associated private field; the special `value` keyword represents whatever value is being assigned to the property. [S1]
- **Naming convention** — the property should share the field's name but start with an UPPERCASE letter (`name` field ↔ `Name` property). [S1]
- **Automatic (shorthand) properties** — `public string Name { get; set; }` — no backing field declared manually; the compiler generates one implicitly, producing identical behavior with less code. [S1]
- **Encapsulation benefits** — better control over class members, ability to make a field effectively read-only (get-only) or write-only (set-only), flexibility to change internals without breaking external code, and increased data security. [S1]
## 📖 세부 내용 (Details)
- Full manual property: `class Person { private string name; public string Name { get { return name; } set { name = value; } } }`. [S1]
- Usage: `Person myObj = new Person(); myObj.Name = "Liam"; Console.WriteLine(myObj.Name);``"Liam"` — accessed via the SAME dot syntax as a plain field, even though a get/set pair runs underneath. [S1]
- Automatic property equivalent: `class Person { public string Name { get; set; } }` — same usage, same output, but no explicit `name` field or accessor bodies written. [S1]
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
- **Strings 챕터의 .Length 프로퍼티 미스터리가 여기서 풀림**: Topic_CSharp의 Strings 챕터에서 `.Length`가 괄호 없는 프로퍼티라고 확인했었는데, 이번 챕터가 프로퍼티의 실제 정의(private 필드 + get/set)를 설명함으로써 그 문법적 정체가 명확해짐. [S1]
- **C++에는 없는 언어 차원의 프로퍼티 문법**: C++는 프로퍼티라는 언어 기능이 없어 getName()/setName() 같은 일반 메서드를 관례적으로 작성해야 했지만, C#은 get/set 접근자를 언어 문법으로 제공하며 심지어 자동 프로퍼티(`{ get; set; }`)로 백킹 필드조차 생략할 수 있다는 점이 확인됨 — 캡슐화 구현 비용이 C++보다 훨씬 낮음. [S1]
## 🛠️ 적용 사례 (Applied in summary)
Person 클래스의 private name 필드를 public Name 프로퍼티(get/set)로 감싸 외부에서 myObj.Name으로 안전하게 읽고 쓰는 예제, 그리고 이를 자동 프로퍼티로 축약한 동일 결과의 예제가 원문에서 직접 실전 활용 사례로 제시됨. [S1]
## 💻 코드 패턴 (Code patterns)
Manual property vs. automatic (shorthand) property — same behavior (C#):
```csharp
// Manual
class Person
{
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
}
// Automatic (shorthand) -- no backing field written
class PersonShort
{
public string Name { get; set; }
}
```
## ✅ 검증 상태 및 신뢰도
- **상태:** draft
- **검증 단계:** conceptual
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
- **신뢰 점수:** 0.86
- **중복 검사 결과:** 신규 생성 (New discovery)
## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[C# Tutorial]]
- **관련 개념:** [[CSharp Access Modifiers]], [[CSharp Strings]], [[CSharp Inheritance]], [[CPP Encapsulation]]
- **참조 맥락:** Access Modifiers & Properties 섹션의 마지막 챕터 — Inheritance 섹션으로 이어짐.
## 📚 출처 (Sources)
- [S1] W3Schools — C# Properties (Get and Set) — https://www.w3schools.com/cs/cs_properties.php
## 📝 변경 이력 (Change history)
- 2026-07-04: Initial draft synthesized from the W3Schools "C# Properties (Get and Set)" page (Astra wiki-curation, P-Reinforce v3.1 format).