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,75 @@
|
||||
---
|
||||
id: csharp-arrays-loop
|
||||
title: "C# Loop Through Arrays"
|
||||
category: "Programming_Language"
|
||||
status: "draft"
|
||||
verification_status: "conceptual"
|
||||
canonical_id: ""
|
||||
aliases: ["for loop array C#", "foreach array C#", "C# 배열 순회"]
|
||||
duplicate_of: ""
|
||||
source_trust_level: "B"
|
||||
confidence_score: 0.82
|
||||
created_at: 2026-07-04
|
||||
updated_at: 2026-07-04
|
||||
review_reason: ""
|
||||
merge_history: []
|
||||
tags: ["csharp", "programming-language", "w3schools", "arrays", "loops"]
|
||||
raw_sources: ["https://www.w3schools.com/cs/cs_arrays_loop.php"]
|
||||
applied_in: []
|
||||
github_commit: ""
|
||||
---
|
||||
|
||||
# [[CSharp Arrays Loop]]
|
||||
|
||||
## 🎯 한 줄 통찰 (One-line insight)
|
||||
This chapter directly recycles the exact `foreach` example already shown in the Loops section's Foreach chapter — same `cars` array, same code — but now frames it explicitly AGAINST the indexed `for` loop alternative, making an explicit value judgment the earlier chapter didn't state outright: `foreach` is "easier to write... does not require a counter... more readable," a direct trade-off statement this wiki hasn't seen phrased this bluntly for C or C++'s equivalent range-based loops. [S1]
|
||||
|
||||
## 🧠 핵심 개념 (Core concepts)
|
||||
- **Indexed `for` loop over an array** — uses `.Length` as the loop bound: `for (int i = 0; i < cars.Length; i++) { Console.WriteLine(cars[i]); }`. [S1]
|
||||
- **`foreach` loop over an array** — no counter, no `.Length`, no index: `foreach (string i in cars) { Console.WriteLine(i); }`. [S1]
|
||||
- **Explicit trade-off stated** — `foreach` is easier to write, doesn't need a counter, and is more readable than the indexed `for` — a direct recommendation, not just a neutral alternative. [S1]
|
||||
|
||||
## 📖 세부 내용 (Details)
|
||||
- Indexed loop: `string[] cars = {"Volvo", "BMW", "Ford", "Mazda"}; for (int i = 0; i < cars.Length; i++) { Console.WriteLine(cars[i]); }`. [S1]
|
||||
- Foreach loop (identical to the earlier Foreach Loop chapter's own example): `string[] cars = {"Volvo", "BMW", "Ford", "Mazda"}; foreach (string i in cars) { Console.WriteLine(i); }`. [S1]
|
||||
- Reading aid: "for each string element (called i — as in index) in cars, print out the value of i." [S1]
|
||||
|
||||
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
|
||||
- **foreach가 for보다 명시적으로 권장됨**: 이전 Foreach Loop 챕터는 foreach를 단순히 소개만 했지만, 이번 챕터는 for와 나란히 비교하며 "카운터가 필요 없고 더 읽기 쉽다"고 명시적으로 우위를 선언한다는 점이 확인됨 — 두 방식이 동등한 대안이 아니라 foreach가 권장되는 선택임을 분명히 함. [S1]
|
||||
|
||||
## 🛠️ 적용 사례 (Applied in summary)
|
||||
동일한 자동차 이름 배열을 인덱스 기반 for 루프와 foreach 루프 두 가지로 순회해 비교하는 예제가 원문에서 직접 실전 활용 사례로 제시됨. [S1]
|
||||
|
||||
## 💻 코드 패턴 (Code patterns)
|
||||
Indexed for loop vs. foreach — same output, different readability (C#):
|
||||
```csharp
|
||||
string[] cars = {"Volvo", "BMW", "Ford", "Mazda"};
|
||||
|
||||
for (int i = 0; i < cars.Length; i++)
|
||||
{
|
||||
Console.WriteLine(cars[i]);
|
||||
}
|
||||
|
||||
foreach (string i in cars)
|
||||
{
|
||||
Console.WriteLine(i);
|
||||
}
|
||||
```
|
||||
|
||||
## ✅ 검증 상태 및 신뢰도
|
||||
- **상태:** draft
|
||||
- **검증 단계:** conceptual
|
||||
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
|
||||
- **신뢰 점수:** 0.82
|
||||
- **중복 검사 결과:** 신규 생성 (New discovery)
|
||||
|
||||
## 🔗 지식 그래프 (Knowledge Graph)
|
||||
- **상위/루트:** [[C# Tutorial]]
|
||||
- **관련 개념:** [[CSharp Arrays]], [[CSharp Arrays Sort]], [[CSharp Foreach Loop]]
|
||||
- **참조 맥락:** Arrays 섹션 — Sort Arrays 챕터로 이어짐.
|
||||
|
||||
## 📚 출처 (Sources)
|
||||
- [S1] W3Schools — C# Loop Through Arrays — https://www.w3schools.com/cs/cs_arrays_loop.php
|
||||
|
||||
## 📝 변경 이력 (Change history)
|
||||
- 2026-07-04: Initial draft synthesized from the W3Schools "C# Loop Through Arrays" page (Astra wiki-curation, P-Reinforce v3.1 format).
|
||||
Reference in New Issue
Block a user