partial 分離///) 供 IntelliSenseconst/readonly/建構子注入const 僅用於真正不變的自然常數 (如 DaysInWeek = 7)readonlyDebug.Assert 驗證前置/後置條件throw new Exception()catch 區塊重拋時用 throw; 保留堆疊 (非 throw ex;)ApplicationException 並實作序列化Main),EXE 極小化,業務邏輯移至類別庫internal,僅公開必要 APIInternalsVisibleTo (增加組件耦合)int)if 區塊永遠用大括號,即使單行?: (除非極簡單)public/protected 欄位,改用屬性override,非 newsealed 類別的 public/protected 方法標記 virtualunsafeas 搭配 null 檢查,避免直接轉型拋例外!= null (或 ?.Invoke)add/remove 存取器封裝委派欄位EventHandlerList 管理大量事件obj as IInterface + null 檢查.resx),不硬編碼appsettings.json/web.config)StringBuilderTrace/Debug 記錄診斷資訊goto 僅用於 switch fall-throughswitch 必須有 default 配合 Debug.Assert(false)this 僅用於建構子鏈結 (: this(...))base 僅用於呼叫基類建構子/覆寫成員IDisposable 模式 (Dispose/Finalize)object 裝箱/拆箱,用泛型約束或 asICustomerList : IList<Customer>)List<T>, Dictionary<TKey,TValue>)