Files
2nd/10_Wiki/Topics/Domain_Programming/Topic_CSharp/CSharp_Syntax.md
T
Antigravity Agent c24165b8bc refactor(topics): 멀티 에이전트용 지식 재편 — _Common(공통 기본기) + Domain_* 구조
에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게
[공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류.
문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인).

- Topic_Programming → Domain_Programming (내부 구조 보존)
- Topic_Graphic → Domain_Design
- Topic_Business → Domain_Product
- Topic_General → Domain_General
- _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning),
  Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing)
- 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서)
- 빈 폴더 정리 (memory/procedures)
- 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 11:05:56 +09:00

4.8 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-syntax C# Syntax Programming_Language draft conceptual
using System
namespace class Main
C# 문법
B 0.86 2026-07-04 2026-07-04
csharp
programming-language
w3schools
syntax
https://www.w3schools.com/cs/cs_syntax.php

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 (namespaceclassMain 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-sensitivityMyClass 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#):

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)

📚 출처 (Sources)

📝 변경 이력 (Change history)

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