Skip to content

TSTS_Constants

Joe Care edited this page Oct 18, 2025 · 1 revision

Constants

Vergleich von const und readonly in C#.

Inhalte

  • const zur Compilezeit, inlinend in aufrufenden Assemblys
  • readonly-Felder: zur Laufzeit im Konstruktor setzbar
  • static readonly vs. const
  • Versionierungsfallen bei const

Beispiele

  • API-Design: öffentliche const vermeiden, stattdessen static readonly
  • Unveränderliche Konfigurationen

Weiterführend

Clone this wiki locally