--- id: csharp-operators-assignment title: "C# Assignment Operators" category: "Programming_Language" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["+= -= *= C#", "compound assignment C#", "C# 대입 연산자"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.83 created_at: 2026-07-04 updated_at: 2026-07-04 review_reason: "" merge_history: [] tags: ["csharp", "programming-language", "w3schools", "operators", "assignment"] raw_sources: ["https://www.w3schools.com/cs/cs_operators_assignment.php"] applied_in: [] github_commit: "" --- # [[CSharp Assignment Operators]] ## 🎯 한 줄 통찰 (One-line insight) All 11 compound assignment operators listed here — including the bitwise ones (`&= |= ^= >>= <<=`) — are identical in symbol and "same as" expansion to C/C++'s set, confirming that C#'s bitwise operator support (and its assignment-operator shorthand) was inherited wholesale rather than redesigned, despite C# otherwise being a managed, higher-level language than C/C++. [S1] ## 🧠 핵심 개념 (Core concepts) - **`=`** — basic assignment. [S1] - **`+= -= *= /= %=`** — arithmetic compound assignment; each `x op= y` expands to `x = x op y`. [S1] - **`&= |= ^=`** — bitwise AND/OR/XOR compound assignment. [S1] - **`>>= <<=`** — bitwise right-shift/left-shift compound assignment. [S1] - Every compound operator is pure shorthand — no operator introduces new semantics beyond "apply the operation, then reassign." [S1] ## 📖 세부 내용 (Details) - Basic assignment: `int x = 10;`. [S1] - Addition assignment: `int x = 10; x += 5;` → `x` becomes 15. [S1] - Full expansion table: `x = 5` → `x = 5`; `x += 3` → `x = x + 3`; `x -= 3` → `x = x - 3`; `x *= 3` → `x = x * 3`; `x /= 3` → `x = x / 3`; `x %= 3` → `x = x % 3`; `x &= 3` → `x = x & 3`; `x |= 3` → `x = x | 3`; `x ^= 3` → `x = x ^ 3`; `x >>= 3` → `x = x >> 3`; `x <<= 3` → `x = x << 3`. [S1] ## ⚖️ 모순 및 업데이트 (Contradictions & updates) - **비트 연산 대입 연산자까지 C/C++와 동일**: `&= |= ^= >>= <<=`를 포함한 11개 대입 연산자 전체가 C/C++의 집합과 기호·확장 규칙이 동일하다는 점이 확인됨 — C#이 매니지드 런타임 위에서 동작하는 상위 언어임에도 비트 연산 지원을 그대로 계승했음을 보여줌. [S1] ## 🛠️ 적용 사례 (Applied in summary) 현재 발견된 실제 적용 사례가 없습니다 — `x += 5;` 하나의 덧셈 대입 예제가 원문에서 제시됨. [S1] ## 💻 코드 패턴 (Code patterns) Compound assignment shorthand — identical to C/C++ (C#): ```csharp int x = 10; x += 5; // same as x = x + 5; -> x is now 15 ``` ## ✅ 검증 상태 및 신뢰도 - **상태:** draft - **검증 단계:** conceptual - **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body) - **신뢰 점수:** 0.83 - **중복 검사 결과:** 신규 생성 (New discovery) ## 🔗 지식 그래프 (Knowledge Graph) - **상위/루트:** [[C# Tutorial]] - **관련 개념:** [[CSharp Operators]], [[CSharp Operators Comparison]], [[CPP Operators Assignment]] - **참조 맥락:** Operators 섹션 — Comparison Operators 챕터로 이어짐. ## 📚 출처 (Sources) - [S1] W3Schools — C# Assignment Operators — https://www.w3schools.com/cs/cs_operators_assignment.php ## 📝 변경 이력 (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "C# Assignment Operators" page (Astra wiki-curation, P-Reinforce v3.1 format).