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
+77
View File
@@ -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).