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:
Antigravity Agent
2026-07-05 00:39:13 +09:00
parent 9148c358d0
commit e9cbf23ab5
1356 changed files with 0 additions and 12831 deletions
@@ -0,0 +1,77 @@
---
id: csharp-arrays
title: "C# Arrays"
category: "Programming_Language"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["array declaration C#", "new keyword arrays", "C# 배열"]
duplicate_of: ""
source_trust_level: "B"
confidence_score: 0.84
created_at: 2026-07-04
updated_at: 2026-07-04
review_reason: ""
merge_history: []
tags: ["csharp", "programming-language", "w3schools", "arrays"]
raw_sources: ["https://www.w3schools.com/cs/cs_arrays.php"]
applied_in: []
github_commit: ""
---
# [[CSharp Arrays]]
## 🎯 한 줄 통찰 (One-line insight)
C#'s array declaration puts the brackets right after the TYPE (`string[] cars;`), not after the variable name like C's `char cars[4];` — a real syntactic divergence hiding under superficial similarity, and the tutorial explicitly documents FOUR equivalent ways to construct the same array (bare braces, `new type[size]`, `new type[size] {...}`, `new type[] {...}`), while also stating a hard rule the C family never needed: if you declare an array first and assign its values LATER (in a separate statement), the `new` keyword becomes MANDATORY — omitting it is a compile error, unlike C where separate declaration and initialization of an array is simply not possible with a brace list at all. [S1]
## 🧠 핵심 개념 (Core concepts)
- **Declaration syntax** — `type[] variableName;` — brackets attach to the TYPE, not the variable name (contrast with C's `type variableName[size];`). [S1]
- **Array literal** — `string[] cars = {"Volvo", "BMW", "Ford", "Mazda"};` — values in a comma-separated, brace-wrapped list. [S1]
- **Index access, 0-based** — `cars[0]` is the first element, same convention as every prior language in this series. [S1]
- **Mutable elements** — `cars[0] = "Opel";` overwrites an existing element directly. [S1]
- **`.Length` property** — no parentheses, matching the string `.Length` property's design (property, not method). [S1]
- **Four equivalent construction forms**: `new string[4]` (empty, size 4), `new string[4] {...}` (size + values), `new string[] {...}` (values, size inferred), and bare `{...}` (values, size inferred, no `new`). [S1]
- **`new` becomes mandatory when assigning after declaration** — `string[] cars; cars = new string[] {"Volvo", "BMW", "Ford"};` works, but `cars = {"Volvo", "BMW", "Ford"};` (without `new`) is a compile error. [S1]
## 📖 세부 내용 (Details)
- Access: `string[] cars = {"Volvo", "BMW", "Ford", "Mazda"}; Console.WriteLine(cars[0]); // Volvo`. [S1]
- Modify: `cars[0] = "Opel"; Console.WriteLine(cars[0]); // Opel`. [S1]
- Length: `Console.WriteLine(cars.Length); // 4`. [S1]
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
- **대괄호가 변수명이 아니라 타입에 붙음**: C의 배열 선언은 `char cars[4];`처럼 대괄호가 변수명 뒤에 붙었지만, C#은 `string[] cars;`처럼 타입 바로 뒤에 대괄호가 붙는다는 점이 확인됨 — 표면적으로 비슷해 보이지만 실제 문법 위치가 다름. [S1]
- **선언 후 대입 시 new가 필수가 됨**: 선언과 초기화를 분리할 경우(`string[] cars;` 이후 `cars = {...};`) 중괄호만으로는 컴파일 에러가 나고 반드시 `new string[] {...}`처럼 new를 붙여야 한다는 규칙이 확인됨 — C는애초에 배열을 선언 후 별도 문장에서 중괄호 리스트로 재할당하는 것 자체가 불가능하므로 C에는 없던 규칙. [S1]
## 🛠️ 적용 사례 (Applied in summary)
자동차 이름 배열을 선언하고, 첫 원소를 읽고 바꾸고, 길이를 확인하는 기본 흐름이 원문에서 직접 실전 활용 사례로 제시됨. [S1]
## 💻 코드 패턴 (Code patterns)
Four equivalent array construction forms, and the mandatory `new` on later assignment (C#):
```csharp
string[] cars1 = new string[4]; // empty, size 4
string[] cars2 = new string[4] {"Volvo", "BMW", "Ford", "Mazda"};
string[] cars3 = new string[] {"Volvo", "BMW", "Ford", "Mazda"};
string[] cars4 = {"Volvo", "BMW", "Ford", "Mazda"}; // no `new` needed here
string[] cars5;
cars5 = new string[] {"Volvo", "BMW", "Ford"}; // new REQUIRED when assigned separately
// cars5 = {"Volvo", "BMW", "Ford"}; // error without new
```
## ✅ 검증 상태 및 신뢰도
- **상태:** draft
- **검증 단계:** conceptual
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
- **신뢰 점수:** 0.84
- **중복 검사 결과:** 신규 생성 (New discovery)
## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[C# Tutorial]]
- **관련 개념:** [[CSharp Break]], [[CSharp Arrays Loop]], [[C Arrays]], [[CPP Arrays]]
- **참조 맥락:** Arrays 섹션 — Loop Through Arrays 챕터로 이어짐.
## 📚 출처 (Sources)
- [S1] W3Schools — C# Arrays — https://www.w3schools.com/cs/cs_arrays.php
## 📝 변경 이력 (Change history)
- 2026-07-04: Initial draft synthesized from the W3Schools "C# Arrays" page (Astra wiki-curation, P-Reinforce v3.1 format).