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.
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
---
|
||||
id: csharp-syntax
|
||||
title: "C# Syntax"
|
||||
category: "Programming_Language"
|
||||
status: "draft"
|
||||
verification_status: "conceptual"
|
||||
canonical_id: ""
|
||||
aliases: ["using System", "namespace class Main", "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", "syntax"]
|
||||
raw_sources: ["https://www.w3schools.com/cs/cs_syntax.php"]
|
||||
applied_in: []
|
||||
github_commit: ""
|
||||
---
|
||||
|
||||
# [[CSharp Syntax]]
|
||||
|
||||
## 🎯 한 줄 통찰 (One-line insight)
|
||||
C# mandates that EVERY line of executable code live inside a `class` — there is no C-style bare top-level `int main()`, no C++-style free function outside any class — which means C#'s minimal program has a mandatory extra nesting layer (`namespace` → `class` → `Main` method) that neither C nor C++ required, and the tutorial explicitly flags one specific Java-vs-C# difference unprompted: unlike Java, the C# filename does NOT have to match the class name (even though convention usually makes them match anyway). [S1]
|
||||
|
||||
## 🧠 핵심 개념 (Core concepts)
|
||||
- **`using System;`** — imports the System namespace, enabling unqualified use of its classes (e.g. `Console` instead of `System.Console`). [S1]
|
||||
- **`namespace`** — a container for classes and other namespaces, used to organize code. [S1]
|
||||
- **`class`** — a container for data and methods; ALL executable C# code must be inside a class, with no exception (unlike C's free-standing `main()` or C++'s optional free functions). [S1]
|
||||
- **Curly braces `{}`** — mark the beginning/end of every code block (namespace body, class body, method body). [S1]
|
||||
- **`Main` method** — the entry point; code inside its braces is what actually executes when the program runs. [S1]
|
||||
- **`Console.WriteLine()`** — a method of the `Console` class (part of the `System` namespace) used to print text; omitting `using System;` requires the fully-qualified `System.Console.WriteLine()` instead. [S1]
|
||||
- **Semicolons mandatory** — every C# statement ends with `;`. [S1]
|
||||
- **Case-sensitivity** — `MyClass` and `myclass` are distinct identifiers. [S1]
|
||||
- **Filename vs. class name** — unlike Java (where the public class name MUST match the filename), C# does not enforce this; matching them is convention only, and the saved file must end in `.cs`. [S1]
|
||||
|
||||
## 📖 세부 내용 (Details)
|
||||
- Full annotated example, line by line: `using System;` (namespace import) → blank line (ignored whitespace, used for readability) → `namespace HelloWorld` (organizational container) → `{` (block start) → `class Program` (mandatory class wrapper) → `static void Main(string[] args)` (entry point, keywords deferred to later chapters) → `Console.WriteLine("Hello World!");` (the actual output statement). [S1]
|
||||
|
||||
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
|
||||
- **모든 실행 코드가 반드시 class 안에 있어야 함**: C는 최상위 함수(`int main()`)를, C++는 클래스 밖의 자유 함수(free function)도 허용했지만, C#은 실행되는 모든 코드 줄이 반드시 class 내부에 있어야 한다는 제약이 명시적으로 확인됨 — namespace→class→Main이라는 필수 3중 중첩 구조. [S1]
|
||||
- **파일명과 클래스명 일치가 Java와 달리 강제되지 않음**: 원문이 직접 "Unlike Java, the name of the C# file does not have to match the class name"이라고 명시 — Java는 public 클래스명과 파일명이 반드시 일치해야 하는 반면, C#은 관례일 뿐 강제 규칙이 아님이 확인됨. [S1]
|
||||
|
||||
## 🛠️ 적용 사례 (Applied in summary)
|
||||
이전 챕터(Get Started)에서 등장한 동일한 Hello World 보일러플레이트를 한 줄씩 분해 설명하는 것이 이번 챕터의 실전 활용 사례로 제시됨. [S1]
|
||||
|
||||
## 💻 코드 패턴 (Code patterns)
|
||||
Minimal C# program structure — namespace/class/Main nesting is mandatory (C#):
|
||||
```csharp
|
||||
using System;
|
||||
namespace HelloWorld
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello World!");
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## ✅ 검증 상태 및 신뢰도
|
||||
- **상태:** draft
|
||||
- **검증 단계:** conceptual
|
||||
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
|
||||
- **신뢰 점수:** 0.86
|
||||
- **중복 검사 결과:** 신규 생성 (New discovery)
|
||||
|
||||
## 🔗 지식 그래프 (Knowledge Graph)
|
||||
- **상위/루트:** [[C# Tutorial]]
|
||||
- **관련 개념:** [[CSharp Get Started]], [[CSharp Output]], [[Java Intro]], [[CPP Namespaces]]
|
||||
- **참조 맥락:** Basics 섹션 — Output 챕터로 이어짐.
|
||||
|
||||
## 📚 출처 (Sources)
|
||||
- [S1] W3Schools — C# Syntax — https://www.w3schools.com/cs/cs_syntax.php
|
||||
|
||||
## 📝 변경 이력 (Change history)
|
||||
- 2026-07-04: Initial draft synthesized from the W3Schools "C# Syntax" page (Astra wiki-curation, P-Reinforce v3.1 format).
|
||||
Reference in New Issue
Block a user