下面列出了迄今爲止你應該瞭解的關於C#博客的2000件事的全部帖子。express 帖子總數= 1,219編程 大會windows
基本visual-studio-code
- #1 - Main()簽名的樣子
- #2 - 最小的C#程序
- #3 - 誰設計了C#?
- #4 - C#與Java有什麼不一樣?
- #5 - C#與VB.NET有何不一樣?
- #6 - 一個更小的C#程序
- #8 - Main()函數能夠返回一個int
- #9 - Main()不該該公開
- #10 - Main()的返回值在Windows中設置ERRORLEVEL變量
- #12 - 讀取命令行參數
- #18 - 什麼是標識符?
- #19 - 上下文關鍵字
- #20 - 文學
- #21 - 布爾文字
- #22 - 整數文字
- #23 - 真正的文學
- #24 - 字符文字
- #26 - Null Literal
- #27 - 表達式,運算符和操做數
- #28 - 運營商優先權
- #29 - 評論
- #35 - 聲明變量
- #36 - 可變初始化和肯定分配
- #45 - 班級的靜態成員
- #46 - 只有一個靜態數據副本
- #52 - 算術運算符
- #53 - 模數
- #54 - 增量和減量運算符
- #55 - 截斷中的整數除法結果
- #56 - 將Float轉換爲Int時如何舍入
- #67 - 參考類型相等的默認行爲
- #72 - 十六進制數
- #73 - 按位運算符
- #74 - 轉移運算符
- #75 - 轉移時的新比特
- #77 - 特殊浮點值
- #78 - 檢查特殊浮點值
- #79 - NaN的平等檢查
- #83 - .NET中的JIT編譯
- #84 - 將元數據視爲源代碼
- #85 - C#程序的通常結構
- #86 - 平等和不平等運算符
- #87 - 關係運算符
- #88 - 條件運算符
- #89 - 否認運營商
- #90 - 更復雜的邏輯表達式
- #91 - 條件運算符能夠進行短路評估
- #92 - 三元條件運算符
- #110 - 將算術運算符與賦值運算符組合
- #111 - 將邏輯或移位運算符與賦值運算符組合在一塊兒
- #117 - 使用#define定義符號
- #118 - 禁用特定編譯器警告
- #181 - C#強類型
- #182 - C#是(大部分)強類型
- #183 - 使用var告訴編譯器弄清楚類型
- #184 - 對象類型的做弊類型安全
- #185 - 堆和堆棧
- #186 - 堆上的值類型
- #187 - 一切都是對象
- #188 - 對象在堆中,對象的引用在堆棧中
- #189 - 基於堆棧的對象的內存管理
- #190 - 基於堆的對象的內存管理
- #199 - 您沒法顯式刪除基於堆的對象
- #200 - 靜態數據和常量存儲在堆上
- #201 - 你能夠在C#中泄漏內存
- #202 - 對象中的全部字段都自動初始化
- #204 - 關於使用隱式類型變量的三條規則
- #205 - 用戶可定義的五種類型
- #206 - 值類型不能表示空值
- #207 - 可空類型
- #208 - 你可使任何值類型爲Nullable
- #209 - 爲何你想在變量中存儲空值
- #222 - C#發音爲「C Sharp」
- #223 - 爲您的項目啓用代碼分析
- #224 - 代碼分析會遇到問題的一個例子
- #225 - 使用FxCop進行自由靜態分析
- #371 - 表明基礎知識
- #372 - 表明們有什麼好處
- #373 - 表明能夠參考多種方法
- #374 - 自定義委託派生自System.MulticastDelegate
- #375 - 使用GetInvocationList獲取單個表明的列表
- #376 - 在委託調用期間發生異常時會發生什麼
- #377 - 確保使用GetInvocationList調用全部代理的方法
- #385 - 委託實例能夠引用實例和靜態方法
- #391 - 將代理實例做爲參數傳遞
- #401 - 每一個對象都繼承一個等於方法
- #402 - 價值平等與參考平等
- #403 - 參考類型的等於方法與==運算符
- #404 - 等於方法與==運算符的值類型
- #406 - 覆蓋Equals方法
- #407 - 爲何在覆蓋等於時應該覆蓋GetHashCode
- #411 - 覆蓋值類型的等於方法
- #413 - 使用Object.ReferenceEquals檢查引用相等性
- #417 - 爲價值平等提供特定類型的等價方法
- #418 - 實現IComparable接口
- #420 - 實施價值平等和IComparable的洗衣清單
- #421 - 價值平等和IComparable示例
- #424 - 垃圾收集器
- #425 - 不肯定性破壞和對象終結
- #426 - 使用析構函數釋放非託管資源
- #427 - Finalizer Gotchas
- #428 - 終結器應始終調用其基類的終結器
- #429 - 使用Dispose Pattern進行肯定性破壞
- #430 - 處理模式示例
- #431 - using語句自動調用Dispose方法
- #432 - 在using語句中初始化多個對象
- #467 - 元數據
- #468 - 容許向程序元素添加元數據的屬性
- #469 - 將屬性附加到類型成員
- #470 - 定義本身的自定義屬性
- #471 - 使用反射讀取屬性的值
- #472 - 屬性能夠附加到各類元素上
- #473 - 指定能夠應用自定義屬性的元素類型
- #475 - 在字符串文字中顯示的註釋被視爲字符串的一部分
- #476 - 不要在標識符中使用Unicode轉義序列
- #499 - 條件編譯符號定義或未定義
- #500 - #define和#undef必須位於文件頂部
- #501 - C ++中的#define和C#之間的差別
- #502 - #define和#undef範圍
- #503 - 使用#if / #endif指令有條件地編譯代碼
- #504 - 使用#else指令
- #505 - 使用#elif指令
- #506 - 在#if和#elif指令中使用表達式
- #507 - 您能夠在#if Block中#define其餘符號
- #508 - 使用#error和#warning指令
- #509 - 使用#pragma warning Directive禁用編譯時警告
- #514 - 運營商優先順序的例子
- #515 - 二元運算符是左關聯的
- #516 - 做業運算符是右關聯的
- #518 - 分割跨多個文件的類的實現
- #521 - 命名空間幫助組織類型
- #522 - 類型的徹底限定名稱包括命名空間
- #523 - 使用指令容許省略命名空間
- #524 - 命名空間中的全部類型必須是惟一的
- #525 - 命名空間能夠嵌套
- #526 - 使用語句能夠別名嵌套命名空間
- #527 - 使用點表示法定義嵌套命名空間
- #529 - using指令能夠爲命名空間建立別名
- #530 - 命名空間與程序集
- #531 - 命名命名空間的最佳實踐
- #532 - 使用來自不一樣程序集的相同命名類型
- #533 - 外部別名的替表明示法
- #535 - 建立通用結構
- #542 - 命名類型參數的約定
- #543 - 能夠對通用類型對象執行的操做
- #544 - 指定類型參數的約束
- #545 - 爲多個類型參數指定約束
- #550 - 匿名方法不須要正式參數
- #551 - 添加到調用列表時使用匿名方法
- #552 - 匿名方法能夠訪問聲明它們的局部變量
- #583 - 您沒法修改foreach循環中的迭代器變量
- #640 - 您沒法使用的方法名稱
- #659 - 獲取有關對象類型的信息
- #660 - typeof運算符獲取有關類型的信息
- #661 - 每一個對象都有一個ToString方法
- #662 - 覆蓋自定義類型的ToString方法
- #664 - 物理內存與虛擬內存
- #665 - 最大虛擬內存量
- #666 - 使用性能計數器查看.NET內存使用狀況
- #667 - 垃圾收集器運行時.NET內存性能計數器更新
- #668 - GetTotalMemory表示您分配了多少內存
- #673 - 使用Statement中使用的類型必須實現IDisposable
- #689 - 參考和對象
- #707 - 程序中的多個類能夠包含主要方法
- #709 - 一種方法能夠從新定義父類中存在的名稱
- #710 - 塊中聲明的變量在塊外不可見
- #711 - 全局命名空間
- #712 - 輔助功能摘要
- #713 - 明確聲明可訪問性
- #714 - 內部類型中公共方法的可訪問性
- #718 - 範圍
- #721 - 本地變量聲明能夠隱藏類成員
- #722 - 本地變量聲明可能沒法始終隱藏類成員
- #724 - 類型的徹底限定名稱
- #730 - 在迭代前使用foreach語句檢查null
- #732 - 毀滅與收藏
- #733 - 如何判斷對象是否收集了垃圾
- #734 - 訪問經過WeakReference引用的原始對象
- #735 - 不要相信WeakReference.IsAlive若是它返回true
- #736 - 垃圾收集後,WeakReference的目標將爲null
- #738 - 你不該該明確強制垃圾收集
- #740 - 短時間與長期弱參考
- #771 - System.Object成員摘要
- #803 - 您可能使用var關鍵字時的狀況
- #804 - 使用var關鍵字時的權衡
- #805 - 自定義使用var關鍵字的示例
- #806 - 強制使用var關鍵字的示例
- #846 - 調用堆棧跟蹤已調用的方法
- #847 - 調用堆棧的工做原理
- #921 - 顯式建立但自動銷燬的對象
- #922 - 發佈對象引用的方法
- #923 - 一個對象不會被刪除,由於它被解除引用
- #924 - 您一般不該該擔憂內存管理問題
- #940 - 應用程序關閉時調用終結器
- #941 - 檢查對象是不是一次性的
- #949 - 哪一個版本的C#是什麼
- #950 - C#具備統一類型系統
- #951 - 不是每種類型都來自對象
- #952 - 類型安全
- #953 - 靜態打字與動態打字
- #954 - 靜態打字與強類型
- #955 - C#是一種託管語言
- #956 - 公共語言基礎結構(CLI)
- #957 - 命名包含C#代碼的文件
- #958 - 標識符的命名約定
- #959 - 不要在標識符的開頭使用雙下劃線
- #960 - 命名類的約定
- #961 - 檢索命令行和可執行文件的路徑
- #962 - 語句能夠跨越多行
- #963 - 使用大括號括起一塊語句
- #964 - 在語句塊中聲明變量
- #965 - 縮進代碼以提升可讀性
- #966 - Visual Studio代碼編輯器幫助縮進
- #967 - 爲變量賦值
- #968 - 從變量中讀取值
- #969 - 建立一個簡單的控制檯應用程序
- #971 - 從控制檯讀取輸入線
- #972 - 從控制檯讀取擊鍵
- #973 - 複合格式字符串中的格式項能夠按任意順序排列
- #974 - 寫得很好的代碼包括寫得好的評論
- #975 - 評論您的準則的指南
- #981 - C#關鍵字的完整列表
- #985 - 爲何它對條件運算符進行短路評估頗有用
- #987 - 使用指令能夠爲類型建立別名
- #988 - 使用global顯式引用命名空間
- #989 - 將數字格式化爲十六進制
- #990 - 將十六進制字符串轉換爲數字數據
- #994 - Unicode基礎知識
- #995 - Unicode代碼點
- #996 - UTF-16編碼,第一部分
- #997 - UTF-16編碼,第二部分
- #998 - UTF-8編碼
- #999 - UTF-16和UTF-8編碼的一些例子
- #1,000 - UTF-8和ASCII
- #1,001 - 表明Unicode代理對
- #1,002 - 寫入文件時指定字符編碼
- #1,017 - 委託類型與委託實例
- #1,018 - 委託調用語法
- #1,019 - 向委託的調用列表添加方法的語法
- #1,020 - 從委託的調用列表中刪除方法
- #1,021 - 表明的回報值會發生什麼
- #1,022 - 如何使用全部代理實例的返回值
- #1,077 - 十進制數字系統
- #1,078 - 十六進制數字系統
- #1,079 - 二進制數字系統
- #1,080 - 二進制數字寫爲十六進制
- #1,081 - 比特,字節和半字節
- #1,082 - Big-endian和Little-endian
- #1,083 - 使用Visual Studio驗證Little-Endianness
- #1,084 - 使用科學記數法表示數字
- #1,085 - 二進制浮點數
- #1,086 - 將十進制浮點數轉換爲二進制浮點數
- #1,087 - 使用科學記數法表示二進制浮點數
- #1,088 - 如何在.NET中存儲32位浮點數,第一部分
- #1,089 - 如何在.NET中存儲32位浮點數,第二部分
- #1,090 - 使用Visual Studio驗證如何存儲浮點數
- #1,091 - 次正規浮點數
- #1,092 - 正面和負面零點
- #1,093 - 如何存儲正負零值
- #1,094 - 正面和負面無限
- #1,095 - 如何存儲浮點無窮大值
- #1,096 - 浮點NaN值
- #1,097 - 如何在.NET中存儲浮點數的摘要
- #1,098 - 浮點溢出
- #1,099 - 重載增量運算符
- #1,102 - 範圍與宣言空間
- #1,103 - 塊定義範圍和聲明空間
- #1,104 - 沒法在嵌套塊中從新聲明變量
- #1,105 - 在方法中從新聲明類級變量
- #1,112 - 如何在.NET中存儲整數
- #1,113 - 使用二進制補碼添加整數
- #1,127 - 在何處查找編譯器警告號
- #1,128 - 禁用整個項目的編譯時警告
- #1,149 - 通用委託類型
- #1,150 - 通用委託類型做爲參數
- #1,151 - Func委託類型
- #1,152 - 行動表明類型
- #1,153 - 不一樣的委託類型不兼容
- #1,154 - 分配給委託類型時的輸入參數兼容性
- #1,155 - 分配給委託類型時的返回值兼容性
- #1,156 - 協方差和通用表明類型
- #1,157 - 逆變和通用表明類型
類設計模式
- #141 - 爲自定義類型實現ICloneable
- #143 - 深度拷貝實現ICloneable的示例
- #144 - 使用序列化實現深度複製
- #226 - 類和對象
- #227 - 在堆上建立類的實例
- #228 - C#中使用類的面向對象編程
- #229 - 面向對象編程的核心原則
- #230 - 用戶定義的類型是一等公民
- #231 - 在類中聲明和使用實例字段
- #232 - 在類中聲明和使用實例方法
- #233 - 從實例方法返回結果
- #234 - 多個返回語句
- #235 - void方法不須要return語句
- #236 - 從方法返回引用類型
- #237 - 從其中一個方法中引用類字段
- #238 - 從另外一種方法調用方法
- #239 - 本參考文獻
- #240 - 類中的私有和公共實例數據
- #241 - 聲明和使用私有實例方法
- #242 - 在類中聲明和使用屬性
- #243 - 屬性獲取和設置訪問者
- #244 - 爲屬性定義Get Accessor
- #245 - 爲屬性定義Set Accessor
- #246 - 實現只讀屬性
- #247 - 實現只寫屬性
- #248 - 實現返回計算值的屬性
- #249 - 使用get Accessor清理屬性數據
- #250 - 使用set Accessor轉換或驗證屬性數據
- #251 - 類屬性支持封裝原則
- #252 - 自動屬性
- #253 - 實現只讀自動屬性
- #254 - 使用私有集訪問器實現只讀屬性
- #255 - 靜態字段與實例字段
- #256 - 使用靜態字段
- #257 - 私人靜態字段
- #258 - 初始化靜態變量做爲其聲明的一部分
- #259 - 靜態與實例屬性
- #260 - 屬性如何在封面下看
- #261 - 自動屬性如何在封面下看
- #262 - 使用參數將數據傳遞給方法
- #263 - 方法的簽名在其類型中必須是惟一的
- #285 - 班級成員概述
- #286 - 建立類的實例時調用構造函數
- #287 - 您沒必要定義構造函數
- #288 - 將參數傳遞給構造函數
- #289 - 您能夠定義多個構造函數
- #290 - 連接構造函數
- #291 - 若是定義任何構造函數,則無默認構造函數
- #292 - 靜態構造函數初始化靜態數據
- #293 - 您能夠聲明私有構造函數
- #294 - 讓全部構造函數都是私有的,以防止建立對象
- #295 - 什麼時候調用靜態構造函數?
- #299 - Intellisense顯示可用的構造函數
- #303 - 集體成員的可訪問性
- #304 - 私人班級成員
- #305 - 公共級會員
- #306 - 受保護的班級成員
- #307 - 內部班級成員
- #308 - 受保護的內部班級成員
- #309 - 在派生類中訪問受保護的成員
- #310 - 類中字段的可訪問性
- #311 - 類中屬性的可訪問性
- #312 - 類中方法的可訪問性
- #313 - 類中構造函數的可訪問性
- #314 - 靜態構造函數不容許訪問修飾符
- #315 - 靜態方法和屬性的可訪問性
- #322 - 類可訪問性
- #323 - 通用類是類的模板
- #324 - 通用類能夠有多個類型參數
- #325 - Intellisense理解通用類
- #326 - 通用類型與構造類型
- #329 - 一個類能夠繼承另外一個類的數據和行爲
- #330 - 派生類不會繼承構造函數
- #331 - 隱式地與顯式地調用基類構造函數
- #332 - 每一個類都徹底屬於一個類
- #333 - 類繼承致使類的層次結構
- #334 - 基類變量能夠引用派生類的實例
- #335 - 使用基類變量訪問派生類
- #336 - 聲明和使用只讀字段
- #337 - 聲明和使用靜態只讀字段
- #338 - 靜態只讀字段與常量
- #339 - 只讀字段與只讀屬性
- #342 - 使用靜態變量計算類的實例
- #343 - 使用新的關鍵字替換基類中的方法
- #344 - 基於聲明的對象類型調用隱藏的基類成員
- #345 - 派生類中的方法默認隱藏基類方法
- #346 - 多態性
- #347 - 多態性的另外一個例子
- #348 - 虛方法支持多態性
- #349 - 虛擬和非虛擬方法之間的區別
- #350 - 多態行爲所需的方法修飾符
- #351 - 抽象方法沒有實現
- #352 - 您沒法實例化抽象類
- #353 - 爲何你能夠定義一個抽象類
- #355 - 使用新的關鍵字替換基類中的屬性
- #356 - 基於聲明的對象類型使用隱藏的基類屬性
- #357 - 派生類中的屬性默認隱藏基類屬性
- #358 - 虛擬屬性支持多態性
- #359 - 虛擬和非虛擬屬性之間的區別
- #360 - 多態行爲所需的屬性修飾符
- #361 - 抽象屬性沒有實現
- #362 - 定義索引器
- #363 - 索引器能夠同時獲取和設置訪問者
- #364 - 定義參數爲枚舉類型的索引器
- #365 - 重載索引器
- #366 - 使用多個參數定義索引器
- #517 - 靜態類
- #534 - 泛型有什麼用?
- #546 - 爲同一類型參數指定多個約束
- #547 - 能夠做爲類型參數約束的東西
- #548 - 類型參數約束不超過一個類
- #567 - 更普遍與更窄的類型
- #570 - 參考類型的分配兼容性
- #590 - 構造函數中的可選參數
- #601 - 類能夠從父類繼承並實現接口
- #602 - 初始化類中的字段
- #603 - 使用常量能夠強制從新編譯
- #609 - 省略同一類中靜態成員的類名
- #610 - 財產中的懶惰評估獲取訪問者
- #614 - 子類可訪問性
- #615 - 您沒法刪除基類成員
- #616 - 基類必須知道是否須要多態性
- #617 - 在基類中調用方法的最簡單方法
- #618 - 使用基本關鍵字在基類中調用方法
- #619 - 在基類中調用構造函數
- #620 - 從不一樣程序集中的類繼承
- #621 - 密封類以防止繼承
- #622 - 密封與非密封
- #623 - 在另外一種類型中定義一種類型
- #624 - 嵌套類的可訪問性
- #625 - 使用點表示法引用嵌套類型
- #626 - 嵌套類型選項
- #627 - 結構或類中嵌套類型的可訪問性
- #628 - 爲何你可能會建立一個嵌套類型
- #629 - 嵌套類型具備對父級成員的徹底訪問權限
- #630 - 嵌套類型能夠隱藏外類中的成員
- #631 - 代碼生成工具和部分類
- #639 - 靜態類能夠包含嵌套的非靜態類
- #648 - 使用對象初始化器
- #649 - 建立匿名類型
- #655 - 使用對象初始化程序僅初始化某些屬性
- #656 - 嵌套對象初始化器
- #669 - 經過調用方法初始化字段
- #670 - 靜態與實例初始化
- #671 - 基類構造函數能夠調用虛方法
- #675 - 多態行爲須要虛擬/覆蓋組合
- #676 - 重寫的方法能夠本身被覆蓋
- #677 - 沒法覆蓋標記爲新修改器的方法
- #678 - 沒法覆蓋密封方法
- #679 - 使用虛方法隱藏繼承的方法
- #680 - 虛擬修改器組合
- #681 - 避免使用新關鍵字隱藏方法
- #682 - 新關鍵字的真正緣由
- #683 - 對象能夠多態化的兩種方式
- #684 - 隱藏的基類成員並不是真正隱藏
- #685 - 繼承能夠破壞封裝
- #686 - 繼承與遏制
- #687 - 遏制的一個例子
- #688 - 聚合,組成和遏制
- #690 - 使用此關鍵字區分字段和參數
- #692 - 構造函數中可選參數的兩種方法
- #693 - 構造函數中的命名參數容許最大的靈活性
- #694 - 鏈式構造函數的事件序列
- #696 - 使用靜態屬性計算實例
- #697 - 經過使用訪問修飾符管理封裝
- #698 - 類型成員是隱性私人的
- #699 - 類型是隱含內部的
- #700 - 使用set Accessor強制進行套管
- #701 - 在設置的訪問者中集中業務規則邏輯
- #702 - 自動屬性必須定義get和set Accessors
- #703 - 對象初始化器容許設置字段或屬性
- #704 - 在任何構造函數中使用對象初始化程序
- #708 - 名稱在宣言空間內必須是惟一的
- #715 - 私人會員在派生類中不可見
- #716 - 派生類如何訪問受保護的成員
- #717 - 類成員不能比他們的類型更容易訪問
- #719 - A類中聲明的位置可有可無
- #720 - 方法中聲明的位置很重要
- #723 - 派生類中可能沒法看到子類中的新方法
- #737 - 什麼時候實施終結器
- #739 - 避免在完成後訪問對象
- #741 - 繼承的基礎
- #742 - 一個簡單的繼承示例
- #744 - 繼承的目的
- #751 - 僅部分保留封裝的繼承
- #752 - C#不支持多重繼承
- #753 - 隱式向上轉換爲基類引用
- #754 - 向下轉換爲對派生類的引用
- #768 - 什麼時候調用基類的構造函數
- #769 - 模式 - 覆蓋它時調用基類方法
- #783 - 什麼時候建立靜態類
- #784 - 什麼時候不使用靜態類
- #787 - 避免在類中使用公共字段
- #788 - 支持字段存儲屬性的數據
- #790 - 屬性獲取和設置訪問者能夠有不一樣的訪問修飾符
- #791 - 屬性不是變量
- #795 - 建立不可變類的規則
- #796 - 屬性訪問器的默承認訪問性
- #797 - 設置屬性訪問器的可訪問性
- #798 - 您沒法覆蓋不可訪問的訪問者
- #800 - 接口中的屬性可能包含一個或兩個訪問器
- #801 - 簡單不可變類的一個例子
- #817 - 靜態構造函數引起異常時會發生什麼
- #818 - 實例構造函數引起異常時會發生什麼
- #819 - 私有構造函數可能會阻止繼承
- #820 - 受保護的構造函數容許子類建立實例
- #824 - 複製構造函數製做現有對象的副本
- #825 - 淺拷貝
- #826 - 深拷貝
- #827 - 使用複製構造函數製做深層複製
- #828 - 實現複製構造函數和ICloneable
- #829 - 添加註釋以指示淺層與深層複製
- #830 - ICloneable的問題
- #831 - 在派生類中實現複製構造函數
- #832 - 調用終結器的順序
- #1,023 - 在執行構造函數以前初始化字段
- #1,024 - 將內部成員公開給另外一個大會
- #1,027 - 類型參數與通用類中的類型參數
- #1,028 - 通用類型與通用方法
- #1,029 - 如何在通用類型中定義構造函數
- #1,030 - 要求通用類型參數從指定的類派生
- #1,031 - 要求通用類型參數實現接口
- #1,032 - 要求通用類型參數爲參考或值類型
- #1,033 - 要求通用類型參數具備無參數構造函數
- #1,034 - 使一個類型參數取決於另外一個
- #1,035 - 類型參數約束的摘要
- #1,036 - 指定多種類型參數約束
- #1,037 - 爲多個類型參數指定類型參數約束
- #1,039 - 從通用類派生
- #1,040 - 從構造類型派生
- #1,041 - 從通用類派生時添加新類型參數
- #1,042 - 從自我參照構造類型派生,第一部分
- #1,043 - 從自我參照構造類型派生,第二部分
- #1,044 - 靜態數據在通用類型中的表現方式
- #1,070 - 能夠編譯通用類型
- #1,134 - 使用「of of」術語來表示泛型
- #1,135 - 重載通用類
- #1,137 - 非通用類中的通用方法
- #1,138 - 通用方法中的類型參數能夠被約束
- #1,139 - 通用類型中對象比較的問題
- #1,140 - 比較通用類型中的參考類型對象
- #1,141 - 即便可用於類型化參數的過載,也使用參考等式
- #1,142 - 使用EqualityComparer比較通用類型中的對象
- #1,143 - 在通用類型中實現IEquatable
- #1,144 - 獲取有關通用類型的類型信息
- #1,145 - 對通用類型參數使用反射
- #1,146 - 泛型不支持協方差
- #1,147 - 爲何泛型不支持協方差
- #1,148 - 什麼時候使用通用協變接口
集合數組
數據類型瀏覽器
- #30 - 類型,變量,值,實例
- #31 - 價值類型和參考類型
- #32 - 內置類型
- #34 - 對象類型
- #37 - 全部值類型都有默認構造函數
- #38 - 數據類型層次結構
- #39 - 數值類型的MinValue / MaxValue
- #40 - TrueString和FalseString
- #41 - 實例化參考類型
- #42 - 與對象交互
- #43 - 對象在堆上實例化
- #44 - 對同一對象的多個引用
- #47 - 經過鑄造進行數字轉換
- #48 - 顯式強制轉換如何失敗
- #49 - 什麼時候使用十進制類型
- #50 - System.Char的靜態方法
- #51 - Float Literals必須使用f後綴
- #57 - 整數操做溢出
- #58 - 使用Checked Operator生成整數溢出的異常
- #59 - 使用未經檢查的關鍵字來避免溢出異常
- #76 - 小整數的算術運算
- #80 - 使用十進制類型進行貨幣計算
- #81 - DateTime和TimeSpan類型
- #82 - 一些常見的DateTime和TimeSpan函數
- #93 - 字符文字中的轉義序列
- #94 - 在字符和數字類型之間轉換
- #107 - 定義和使用結構
- #108 - 爲Struct定義構造函數
- #109 - 定義和使用枚舉
- #119 - 陣列
- #120 - 數組聲明和實例化
- #121 - 數組初始化
- #122 - 數組能夠包含任何類型的對象
- #123 - 在數組中存儲任意對象
- #124 - 聲明和實例化多維數組
- #125 - 初始化多維數組
- #126 - 初始化參考類型對象的數組
- #127 - 聲明和實例化鋸齒狀數組
- #128 - 訪問鋸齒狀數組中的元素
- #129 - 初始化鋸齒狀數組
- #130 - 數組元素的默認值
- #131 - Arrays派生自System.Array
- #132 - 多維和鋸齒狀的陣列
- #133 - 數組的長度是固定的
- #134 - 對一維數組進行排序
- #135 - 實現IComparable以容許排序自定義類型
- #136 - 根據鍵數組對值數組進行排序
- #137 - 使用獨立的比較器方法對陣列進行排序
- #138 - 搜索已排序的數組
- #139 - 使用Array.Clone方法制做數組的淺拷貝
- #140 - 使用對象的克隆方法制做數組的深層副本
- #142 - 爲深拷貝實施ICloneable
- #145 - 使用Array.Find搜索未排序的數組
- #146 - 使用Array.FindAll查找數組中的一組匹配元素
- #147 - 獲取數字數組的平均值
- #148 - 獲取自定義對象數組的平均值
- #149 - 使用IEnumerable.Aggregate基於數組中的全部元素執行計算
- #150 - 能夠應用於數字數組的其餘聚合函數
- #151 - 肯定數組是否包含特定元素
- #152 - 使用Distinct()方法刪除重複數組條目
- #153 - 返回匹配特定標準的數組元素子集
- #154 - 使用無效數組索引致使異常被拋出
- #155 - 使用foreach語句迭代數組
- #156 - 在foreach循環中使用break並繼續
- #191 - 更改枚舉的基礎類型
- #192 - 爲枚舉成員使用非默認常量值
- #193 - 枚舉類型的ToString方法顯示成員的名稱
- #194 - 將一組布爾值存儲爲位
- #195 - 使用枚舉類型存儲一組標誌
- #196 - 在基於標誌的枚舉類型上使用ToString()方法
- #197 - 檢查存在標誌的枚舉值
- #198 - 設置標誌組合的枚舉值
- #203 - 始終具備0值枚舉常數的良好實踐
- #210 - 檢查能夠爲空的對象是否有值
- #211 - 使用Null-Coalescing(??)運算符
- #212 - 在同一表達式中使用多個Null-Coalescing(??)運算符
- #213 - 使用Null-Coalescing(??)運算符時的最終操做數
- #214 - 使用帶引用類型的Null-Coalescing(??)運算符
- #215 - 使用具備自定義可空類型的Null-Coalescing(??)運算符
- #216 - Null-Coalescing(??)運算符等效於GetValueOrDefault方法
- #217 - T?至關於Nullable <T>
- #218 - 在堆積經過拳擊中存儲值類型對象
- #219 - 取消裝箱裝箱物品
- #220 - 拳擊能夠自動發生
- #221 - 取消裝箱時,您必須徹底匹配原始類型
- #280 - 隱式類型數組
- #296 - 在使用結構以前,必須爲全部字段賦值
- #297 - 初始化結構內容的三種不一樣方法
- #298 - 結構能夠有幾個構造函數
- #316 - 聲明和使用常量
- #317 - 常數能夠是班級成員
- #318 - 您不能在常量上使用靜態修改器
- #319 - 使用表達式初始化常量
- #320 - 參考類型常量的常量表達式必須爲空
- #321 - 常量的可訪問性
- #327 - 爲新變量分配結構進行復制
- #328 - 複製結構不會複製基礎參考類型
- #367 - 迭代枚舉類型的全部可能值
- #433 - 全部結構都繼承自System.ValueType
- #457 - 在枚舉及其基礎類型之間轉換
- #458 - 枚舉和底層類型之間轉換時的錯誤
- #459 - 爲枚舉分配不一樣類型的值
- #460 - 從字符串轉換爲枚舉類型
- #461 - 枚舉元素不須要是連續的
- #462 - 枚舉類型中的重複枚舉器
- #463 - 枚舉值能夠是任何常量表達式
- #464 - 在運行時獲取枚舉的基礎類型
- #465 - 轉儲枚舉類型的全部名稱和值
- #466 - 僅顯式分配一些枚舉值
- #477 - 字符文字的轉義序列的完整列表
- #510 - 在同一行上聲明多個局部變量
- #519 - 結構和類之間的差別
- #520 - 在結構和類之間進行選擇
- #566 - 可空類型的隱式轉換
- #568 - 數組協方差
- #569 - 做業兼容性
- #571 - 編程語言中的協方差
- #572 - 爲何數組協方差稱爲協方差
- #573 - 數組協方差不適用於值類型
- #574 - 陣列協方差的問題
- #581 - 拳擊和拆箱可空類型
- #582 - 使用as運算符將其置爲可空類型
- #596 - 隱式類型數組和最佳類型推斷
- #598 - 清除數組或數組的子集
- #599 - 將數組複製到另外一個數組
- #600 - 反轉數組中的元素
- #611 - 結構中成員的可訪問性
- #641 - 在結構中使用此關鍵字
- #642 - 在結構中從新分配此指針
- #643 - 結構的構造函數必須初始化全部數據成員
- #644 - 連接結構體構造函數
- #645 - 您能夠連接到結構的默認構造函數
- #646 - 值類型沒有終結器
- #650 - 建立一個匿名類型的對象數組
- #651 - 將匿名類型的對象傳遞給方法
- #652 - 在匿名類型聲明中使用表達式和變量
- #653 - 投影初始化器
- #654 - 您不能直接使用匿名類型
- #657 - 拳擊製做一個物體的副本
- #658 - IL中的拳擊和拆箱效果如何
- #767 - 結構被隱式密封
- #775 - 複製一個匿名類型的對象數組
- #776 - 聲明和使用Nullable結構
- #777 - 結構在用做屬性時不可變
- #778 - 結構在集合中使用時不可變
- #779 - 修改元素的結構中的方法多是危險的
- #780 - 不可變結構的案例
- #781 - 結構能夠實現接口
- #782 - 您能夠在沒有新關鍵字的狀況下建立結構的實例
- #789 - 將常數分組爲本身的類
- #833 - 匿名對象初始化器的一些示例
- #834 - 使用通用列表存儲對象集合
- #835 - 通用列表能夠存儲值類型或參考類型的對象
- #836 - 使用對象初始化程序初始化通用列表
- #837 - Collection Initializers中的Object Initializers
- #838 - 做爲參數的對象和集合初始值設定項
- #839 - 匿名類型限制
- #840 - 使用匿名類型做爲對象的只讀子集
- #982 - 枚舉類型能夠存儲最多32個標誌
- #983 - 使用BitArray存儲大量布爾值
- #991 - 使用往返格式說明符
- #992 - System.Char數據類型
- #993 - 角色的一些例子
- #1,012 - 陣列聲明,實例化和初始化的選項
- #1,013 - 默認運算符返回默認值
- #1,014 - 在通用類中使用默認運算符
- #1,015 - 將字節數組渲染爲一系列十六進制字符
- #1,016 - 檢索數組的長度
- #1,025 - 在枚舉類型之間轉換
- #1,026 - 檢查已標記的枚舉類型的有效性
- #1,045 - 從可空類型分配時的隱式轉換
- #1,046 - 隱式與顯式轉換
- #1,047 - 隱式身份轉換
- #1,048 - 簽名與無符號之間沒有隱式轉換
- #1,049 - 隱式數字轉換的完整列表
- #1,050 - 可空類型之間的隱式轉換
- #1,051 - 隱式參考轉換
- #1,052 - 拳擊是一種隱含的轉換
- #1,053 - 類型動態的隱式轉換
- #1,054 - 常量表達式的隱式轉換
- #1,055 - 定義你本身的隱含轉換
- #1,056 - 引用類型之間的自定義隱式轉換
- #1,057 - 自定義顯式轉換
- #1,058 - 兩個方向的自定義隱式轉換
- #1,059 - 從數字轉換爲枚舉類型
- #1,060 - 可空類型之間的顯式轉換
- #1,061 - 顯式引用轉換
- #1,062 - 取消裝箱轉化
- #1,063 - 顯式轉換和類型參數
- #1,064 - 沒法顯式轉換類型參數
- #1,065 - 數組協方差不起做用的狀況
- #1,066 - 在通用接口上約束類型參數
- #1,076 - char類型的隱式數字轉換
- #1,111 - 將整數轉換爲不一樣基數中的字符串
- #1,198 - 使用具備可空類型的運算符
- #1,199 - 具備可空類型的平等和不等式
調試安全
列舉app
活動
例外
輸入輸出
接口
記憶
方法
- #264 - 默認狀況下,參數按值傳遞
- #265 - 按值傳遞引用類型
- #266 - 您沒法阻止方法更改引用類型的內容
- #267 - 使用輸出參數從方法傳回數據
- #268 - 在從方法返回以前,必須設置全部輸出參數的值
- #269 - 在輸入/輸出參數上使用ref修飾符
- #270 - 經過引用傳遞引用類型
- #271 - 傳遞參考類型做爲輸出參數
- #272 - ref和out參數之間的差別
- #273 - 參數修飾符摘要
- #274 - 若是方法僅由ref和out Modifiers不一樣,則沒法重載
- #275 - 將結構傳遞給Method
- #276 - 經過引用傳遞結構
- #277 - 將數組傳遞給方法
- #278 - 經過引用傳遞數組
- #279 - 將多維數組傳遞給方法
- #281 - 在類中聲明和使用靜態方法
- #282 - 建立私有靜態方法
- #283 - 實例方法能夠調用靜態方法
- #284 - 靜態方法能夠調用實例方法
- #340 - 使用參數關鍵字傳遞可變數量的參數
- #341 - 定義和使用局部變量
- #354 - 自動調用正確的重載方法
- #511 - 使用參數數組的規則
- #512 - 將數據傳遞給採用參數數組的方法的兩種方法
- #513 - 一些接受參數數組的熟悉方法
- #538 - 實現通用方法
- #539 - 調用通用方法時的類型推斷
- #540 - 通用類中的非通用方法
- #541 - 通用方法類型參數能夠隱藏類級別類型參數
- #549 - 匿名方法基礎
- #553 - 做爲靜態或實例方法的匿名方法
- #554 - 將匿名方法與委託類型匹配的規則
- #584 - 定義可選參數
- #585 - 可選參數必須最後
- #586 - 可選參數的默認值必須是常量
- #587 - 若是提供,則可選參數必須正確
- #588 - 默認參數值能夠爲空
- #589 - 可選參數必須是輸入參數
- #593 - 使用命名參數
- #594 - 當你想要使用命名參數時
- #597 - 從方法返回一個數組
- #608 - 實例方法可使用靜態數據
- #632 - 部分方法
- #633 - 部分方法的實現是可選的
- #634 - 調用沒有實現的部分方法
- #635 - 部分方法的侷限性
- #636 - 部分方法的緣由
- #637 - 表明能夠參考部分方法
- #638 - 定義和使用部分結構
- #674 - 若是參數僅由ref修飾符不一樣,則能夠重載
- #695 - 靜態方法能夠訪問靜態成員
- #772 - 將數組初始化爲方法調用的一部分
- #774 - 將數組做爲out參數傳遞
- #802 - 方法可能沒有參數
- #807 - 定義和使用擴展方法
- #808 - 向擴展方法添加參數
- #809 - 擴展方法簽名不該與類方法匹配
- #810 - 擴展方法來自何處
- #811 - 擴展方法只能訪問類的公共成員
- #812 - 爲值類型定義擴展方法
- #813 - 爲枚舉類型定義擴展方法
- #814 - 參數與參數
- #815 - 命名與位置參數
- #816 - 命名參數和可選參數組合
- #1,038 - 通用方法的類型參數約束
- #1,136 - 重載通用方法
- #1,165 - Lambda Expression Basics
- #1,166 - Lambda表達式語法
- #1,167 - 將Lambda表達式傳遞給方法
- #1,168 - 使用Lambda表達式做爲事件處理程序
- #1,169 - Lambdas取代匿名方法
- #1,170 - 您沒法使用Lambda表達式取消訂閱事件
- #1,171 - Lambda Expression Internals
- #1,172 - Lambda表達式常常與Func和Action一塊兒使用
- #1,173 - Lambda表達式能夠只是一個表達式
- #1,174 - 將Lambda表達式分配給表達式樹
- #1,175 - 表達式樹的示例
- #1,176 - 表達式樹如何存儲在內存中
- #1,177 - Lambda表達式能夠引用在表達式以外聲明的變量
- #1,178 - 在調用委託時評估捕獲的變量
- #1,179 - 捕獲變量的終身匹配表明
- #1,180 - Lambda表達式能夠修改捕獲的變量
- #1,181 - 在Lambda表達式中實例化對象
- #1,182 - 在Lambda表達式中捕獲for循環變量
- #1,183 - 如何在Lambda表達式中正確捕獲for循環變量
- #1,186 - 在Lambda表達式中捕獲foreach迭代變量
- #1,187 - 添加到調用列表時使用Lambda表達式
- #1,188 - Lambda Expression能夠捕獲實例數據
- #1,189 - Lambda Expression能夠捕獲靜態數據
- #1,190 - Lambda表達式能夠是遞歸的
- #1,191 - Lambda沒法捕獲ref或out參數
雜
- #453 - 使用反射獲取類實現的接口列表
- #480 - 預處理指令
- #725 - 傾倒大會中的類型列表
- #726 - 列出命名空間中的全部類型
- #727 - 獲取程序集中全部命名空間的列表
- #728 - 轉儲.NET Framework中的全部類型
- #729 - 在.NET Framework中轉儲全部類型,第二部分
- #731 - 獲取有關班級成員的信息
- #743 - ASCII藝術生成器
- #745 - 使用ReSharper提升Visual Studio的生產力
- #748 - 使用GhostDoc工具記錄您的代碼
- #749 - 一些C#設計模式的例子
- #750 - 使用xUnit.net進行單元測試
- #757 - 面向對象編程的書籍
- #942 - 懶惰實例化的案例
- #943 - 懶惰實例化,解決方案#1
- #944 - 懶惰實例化,解決方案#2
- #945 - 懶惰實例化,更簡單的解決方案
- #946 - 指定延遲實例化對象是否應該是線程安全的
- #947 - 使用Lambda表達式指定延遲實例化
- #984 - 生日問題
- #1,101 - 數學常數
- #1,202 - C#6.0 - 空條件運算符
- #1,203 - C#6.0 - 使用Null條件和值類型
- #1,204 - C#6.0 - 使用Null-Conditional with Indexer
- #1,205 - C#6.0 - 在調用委託時使用Null-Conditional
- #1,206 - C#6.0 - 自動屬性初始化器
- #1,207 - C#6.0 - 只讀屬性的自動屬性初始值設定項
- #1,208 - C#6.0 - 自動屬性初始化器能夠是任何表達式
- #1,209 - C#6.0 - 使用運營商名稱
- #1,210 - C#6.0 - 主要構造函數
- #1,211 - C#6.0 - 爲主構造函數添加實現
- #1,212 - C#6.0中的特徵列表
- #1,214 - C#6.0 - 使用帶靜態類的指令
- #1,215 - C#6.0 - 字典初始化器的新語法
- #1,216 - C#6.0 - 從構造函數初始化只讀自動屬性
- #1,217 - C#6.0 - 爲函數成員使用Lambda表達式
- #1,218 - C#6.0 - 將Lambdas用於僅限Getter的自動屬性
- #1,219 - C#6.0 - 過濾異常
運營商
- #396 - 做爲班級成員的運營商
- #397 - 定義運營商
- #398 - 可重載運算符
- #399 - 重載一元運算符
- #400 - 重載二元運算符
- #405 - 等價的等價方法,= =身份的運算符
- #408 - 重載參考類型的==運算符
- #409 - 重載==運算符的示例
- #410 - 爲值類型重載==運算符
- #412 - 重載時的指南==值類型的運算符
- #414 - 等價能夠基於字段子集
- #415 - 檢查浮點數是否相等時要當心
- #416 - 使用Epsilon比較兩個浮點數
- #419 - 實現IComparable時覆蓋關係運算符
- #575 - 使用is運算符檢查引用類型對象的類型
- #576 - 將is運算符與值類型對象一塊兒使用
- #577 - 使用is運算符檢查拆箱轉換
- #578 - 使用as運算符進行類型轉換
- #579 - 用做運算符的典型模式
- #580 - 運營商能夠生成編譯時錯誤
- #592 - 索引器中的可選參數
- #1,071 - 一元減號運算符
- #1,072 - 一元減法運算符如何失敗
- #1,073 - 算術二元運算符是左關聯的
- #1,074 - 在表達式中使用括號使代碼更易讀
- #1,075 - 運算符優先級不影響操做數評估順序
- #1,100 - 增量和減量運算符不是線程安全的
- #1,106 - 使用邏輯異或運算符
- #1,107 - 按位AND運算符
- #1,108 - 按位OR運算符
- #1,109 - 按位非運算符
- #1,110 - 按位異或運算符
- #1,114 - 不要使用Shift運算符進行乘法運算
- #1,200 - 邏輯運算符與條件邏輯運算符
- #1,201 - 將條件邏輯運算符編寫爲條件
模式
安全
聲明
字符串
- #14 - C#中的複合格式字符串
- #15 - 在複合格式字符串中使用格式項的長列表
- #16 - 使用一個對象數組做爲複合格式字符串
- #17 - 支持複合格式化的方法
- #25 - 字符串文字
- #33 - 字符串類型
- #60 - 使用Parse從字符串轉換爲數字類型
- #61-非默認文化的格式化和解析字符串
- #62 - 字符串鏈接
- #63 - 使用StringBuilder實現更高效的字符串鏈接
- #64 - 字符串文字中的轉義序列
- #65 - 逐字字符串文字
- #66 - 在字符串中包含引號
- #68 - 字符串平等
- #69 - 字符串是不可變的
- #70 - StringBuilder類
- #71 - StringBuilder容量
- #95 - ToString()在執行字符串鏈接時自動調用
- #96 - 比較字符串值
- #97 - 使用其餘文化的字符串比較
- #98 - 使用索引器獲取字符串中的特定字符
- #99 - 使用StringInfo從UTF32字符串中獲取特定字符
- #100 - 使用IndexOf搜索字符串中的字符
- #101 - 若是字符串包含其餘字符串,請使用Contains()來發現
- #102 - 使用Substring()從字符串中提取子字符串
- #103 - 插入和刪除子串
- #104 - 從字符串中修剪前導和尾隨字符的功能
- #105 - 將字符串函數連接在一塊兒
- #106 - 使用String.Split將字符串解析爲子字符串
- #392 - 使用反向方法反轉字符串
- #422 - 比較字符串時ReferenceEquals的行爲方式
- #478 - 逐字字符串文字能夠跨越多行
- #479 - 相同的字符串文字存儲在同一個對象中
- #773 - 反轉包含表示爲代理對的Unicode字符的字符串
- #970 - 檢查字符串中的有效字符
- #1,003 - 在字符串中訪問不一樣編碼的底層字節
- #1,004 - 將字符串轉換爲大寫或小寫
- #1,005 - 用新的子串替換子串
- #1,006 - 獲取字符串的長度
- #1,007 - 獲取包含代理對的字符串長度
- #1,008 - 當你忘記字符串是不可改變的時候會發生什麼
- #1,009 - 字符串能夠爲空或空
- #1,010 - 檢查字符串是空仍是空
- #1,011 - TryParse指示解析操做是否成功
- #1,116 - 使用foreach語句迭代字符串
視覺工做室
|
2,000 Things You Should Know About C# blog. Total number of posts = 1,219 Assemblies
Basics
- #1 – What the Main() Signature Looks Like
- #2 – The Smallest Possible C# Program
- #3 – Who Designed C#?
- #4 – How is C# Different from Java?
- #5 – How is C# Different from VB.NET?
- #6 – An Even Smaller C# Program
- #8 – The Main() Function Can Return an int
- #9 – Main() Should Not Be Public
- #10 – The Return Value from Main() Sets ERRORLEVEL Variable in Windows
- #12 – Read Command Line Arguments
- #18 – What Is an Identifier?
- #19 – Contextual Keywords
- #20 – Literals
- #21 – Boolean Literals
- #22 – Integer Literals
- #23 – Real Literals
- #24 – Character Literals
- #26 – Null Literal
- #27 – Expressions, Operators and Operands
- #28 – Operator Precedence
- #29 – Comments
- #35 – Declaring Variables
- #36 – Variable Initialization and Definite Assignment
- #45 – Static Members of a Class
- #46 – There Is Only One Copy of Static Data
- #52 – Arithmetic Operators
- #53 – Modulus
- #54 – Increment and Decrement Operators
- #55 – Integer Division Results in Truncation
- #56 – How to Round When Converting Float to Int
- #67 – Default Behavior for Reference Type Equality
- #72 – Hexadecimal Numbers
- #73 – Bitwise Operators
- #74 – Shift Operators
- #75 – New Bits When Shifting
- #77 – Special Floating Point Values
- #78 – Check for Special Floating Point Values
- #79 – Equality Checks for NaN
- #83 – JIT Compilation in .NET
- #84 – Viewing Metadata as Source Code
- #85 – General Structure of a C# Program
- #86 – Equality and Inequality Operators
- #87 – Relational Operators
- #88 – Conditional Operators
- #89 – The Negation Operator
- #90 – More Complex Logical Expressions
- #91 – Conditional Operators Can Short-Circuit Evaluation
- #92 – The Ternary Conditional Operator
- #110 – Combining the Arithmetic Operators with the Assignment Operator
- #111 – Combining the Logical or Shift Operators with the Assignment Operator
- #117 – Use #define to Define a Symbol
- #118 – Disabling Specific Compiler Warnings
- #181 – C# Is Strongly Typed
- #182 – C# is (Mostly) Strongly Typed
- #183 – Use var to Tell the Compiler to Figure out the Type
- #184 – Cheating Type Safety with object Type
- #185 – The Heap and the Stack
- #186 – Value Types on the Heap
- #187 – Everything Is an Object
- #188 – Objects Are on the Heap, References to Objects Are on the Stack
- #189 – Memory Management for Stack-Based Objects
- #190 – Memory Management for Heap-Based Objects
- #199 – You Can’t Explicitly Delete Heap-Based Objects
- #200 – Static Data and Constants Are Stored on the Heap
- #201 – You Can Leak Memory in C#
- #202 – All Fields in an Object Are Automatically Initialized
- #204 – Three Rules About Using Implicitly-Typed Variables
- #205 – Five Kinds of Types That Are User-Definable
- #206 – Value Types Can’t Represent Null Values
- #207 – Nullable Types
- #208 – You Can Make Any Value Type Nullable
- #209 – Why You’d Want to Store a Null Value in a Variable
- #222 – C# Is Pronounced 「C Sharp」
- #223 – Enabling Code Analysis for Your Project
- #224 – One Example of a Problem that Code Analysis Would Catch
- #225 – Free Static Analysis Using FxCop
- #371 – Delegate Basics
- #372 – What Delegates Are Good For
- #373 – A Delegate Can Refer to More than One Method
- #374 – A Custom Delegate Derives from System.MulticastDelegate
- #375 – Using GetInvocationList to Get a List of Individual Delegates
- #376 – What Happens When an Exception Occurs During Delegate Invocation
- #377 – Ensure that All of a Delegate’s Methods Are Called by Using GetInvocationList
- #385 – A Delegate Instance Can Refer to Both Instance and Static Methods
- #391 – Passing a Delegate Instance as a Parameter
- #401 – Every Object Inherits an Equals Method
- #402 – Value Equality vs. Reference Equality
- #403 – Equals Method vs. == Operator for Reference Types
- #404 – Equals Method vs. == Operator for Value Types
- #406 – Overriding the Equals Method
- #407 – Why You Should Override GetHashCode when Overriding Equals
- #411 – Overriding the Equals Method for a Value Type
- #413 – Check for Reference Equality Using Object.ReferenceEquals
- #417 – Provide a Type-Specific Equals Method for Value Equality
- #418 – Implementing the IComparable Interface
- #420 – Laundry List for Implementing Value Equality and IComparable
- #421 – Value Equality and IComparable Example
- #424 – The Garbage Collector
- #425 – Nondeterministic Destruction and Object Finalization
- #426 – Use a Destructor to Free Unmanaged Resources
- #427 – Finalizer Gotchas
- #428 – A Finalizer Should Always Call the Finalizer of Its Base Class
- #429 – Use the Dispose Pattern for Deterministic Destruction
- #430 – A Dispose Pattern Example
- #431 – The using Statement Automates Invocation of the Dispose Method
- #432 – Initialize Multiple Objects in a using Statement
- #467 – Metadata
- #468 – Attributes Allow Adding Metadata to Program Elements
- #469 – Attaching an Attribute to a Type Member
- #470 – Defining Your Own Custom Attribute
- #471 – Reading the Value of an Attribute Using Reflection
- #472 – Attributes Can Be Attached to a Variety of Elements
- #473 – Specifying what Type of Elements a Custom Attribute Can Be Applied To
- #475 – Comments Occuring within String Literals Are Treated as Part of the String
- #476 – Don’t Use Unicode Escape Sequences in Identifiers
- #499 – Conditional Compilation Symbols Are Defined or Undefined
- #500 – #define and #undef Must Be at Top of File
- #501 – Differences Between #define in C++ and C#
- #502 – #define and #undef Scope
- #503 – Conditionally Compile Code Using #if / #endif Directives
- #504 – Using the #else Directive
- #505 – Using the #elif Directive
- #506 – Using Expressions in #if and #elif Directives
- #507 – You can #define Other Symbols within a #if Block
- #508 – Using the #error and #warning Directives
- #509 – Use #pragma warning Directive to Disable Compile-Time Warnings
- #514 – Examples of Operator Precedence
- #515 – Binary Operators Are Left-Associative
- #516 – The Assignment Operator is Right-Associative
- #518 – Splitting the Implementation of a Class Across Multiple Files
- #521 – Namespaces Help Organize Types
- #522 – The Fully Qualified Name for a Type Includes the Namespace
- #523 – The using Directive Allows Omitting Namespace
- #524 – All Types Within a Namespace Must Be Unique
- #525 – Namespaces Can Be Nested
- #526 – Using Statements Can Alias Nested Namespaces
- #527 – Defining a Nested Namespace Using Dot Notation
- #529 – The using Directive Can Create an Alias for a Namespace
- #530 – Namespaces vs. Assemblies
- #531 – Best Practices for Naming Namespaces
- #532 – Using Identically Named Types from Different Assemblies
- #533 – Alternate Notation for Extern Aliases
- #535 – Creating a Generic Struct
- #542 – Conventions for Naming Type Parameters
- #543 – Operations You Can Perform on a Generically Typed Object
- #544 – Specifying a Constraint for a Type Parameter
- #545 – Specifying Constraints for More than One Type Parameter
- #550 – Anonymous Method Does Not Require Formal Parameters
- #551 – Use Anonymous Method When Adding to an Invocation List
- #552 – Anonymous Methods Have Access to Local Variables Where They Are Declared
- #583 – You Can’t Modify the Iterator Variable Within a foreach Loop
- #640 – Method Names that You Cannot Use
- #659 – Get Information About an Object’s Type
- #660 – The typeof Operator Gets Information About a Type
- #661 – Every Object Has A ToString Method
- #662 – Overriding the ToString Method for a Custom Type
- #664 – Physical Memory vs. Virtual Memory
- #665 – Maximum Amount of Virtual Memory
- #666 – Looking at .NET Memory Usage Using Performance Counters
- #667 – .NET Memory Performance Counters Updated When Garbage Collector Runs
- #668 – GetTotalMemory Indicates How Much Memory You’ve Allocated
- #673 – Types Used in using Statement Must Implement IDisposable
- #689 – References and Objects
- #707 – More Than One Class in A Program Can Contain A Main Method
- #709 – A Method Can Redefine a Name Present in Parent Class
- #710 – Variables Declared in a Block Aren’t Visible Outside of the Block
- #711 – The Global Namespace
- #712 – Accessibility Summary
- #713 – Declare Accessibility Explicitly
- #714 – Accessibility of a Public Method in an Internal Type
- #718 – Scope
- #721 – Local Variable Declarations Can Hide Class Members
- #722 – Local Variable Declarations May Not Always Hide Class Members
- #724 – Fully Qualified Names for Types
- #730 – Check for null Before Iterating Using foreach Statement
- #732 – Destruction vs. Collection
- #733 – How to Tell If an Object Has Been Garbage Collected
- #734 – Accessing the Original Object Referenced through a WeakReference
- #735 – Don’t Trust WeakReference.IsAlive If It Returns true
- #736 – Target of a WeakReference Will Be null after Garbage Collection
- #738 – You Shouldn’t Explicitly Force Garbage Collection
- #740 – Short vs. Long Weak References
- #771 – Summary of System.Object Members
- #803 – Situations When You Might Use the var Keyword
- #804 – Tradeoffs when Using the var Keyword
- #805 – An Example of Discretionary Use of the var Keyword
- #806 – An Example of Mandatory Use of the var Keyword
- #846 – A Call Stack Keeps Track of Methods that Have Been Called
- #847 – How the Call Stack Works
- #921 – Objects Are Explicitly Created but Automatically Destroyed
- #922 – Ways in Which References to an Object Are Released
- #923 – An Object Isn’t Necessarily Deleted as Soon as It’s Dereferenced
- #924 – You Shouldn’t Normally Worry about Memory Management
- #940 – Finalizers Are Called when an Application Shuts Down
- #941 – Checking to See If Objects Are Disposable
- #949 – What’s in Which Version of C#
- #950 – C# Has a Unified Type System
- #951 – Not Every Type Derives from object
- #952 – Type Safety
- #953 – Static Typing vs. Dynamic Typing
- #954 – Static Typing vs. Strongly Typed
- #955 – C# Is a Managed Language
- #956 – The Common Language Infrastructure (CLI)
- #957 – Naming Files that Contain C# Code
- #958 – Naming Conventions for Identifiers
- #959 – Don’t Use Double Underscores at the Start of an Identifier
- #960 – Conventions for Naming Classes
- #961 – Retrieving Command Line and Path to Executable
- #962 – Statements Can Span Multiple Lines
- #963 – Use Braces to Enclose a Block of Statements
- #964 – Declaring a Variable within a Block of Statements
- #965 – Indent Code to Improve Readability
- #966 – Visual Studio Code Editor Helps with Indenting
- #967 – Assigning a Value to a Variable
- #968 – Reading a Value from a Variable
- #969 – Creating a Simple Console Application
- #971 – Reading a Line of Input from the Console
- #972 – Reading Keystrokes from the Console
- #973 – Format Items in Composite Format Strings Can Be in Any Order
- #974 – Well Written Code Includes Well Written Comments
- #975 – Guidelines for Commenting Your Code
- #981 – Full List of C# Keywords
- #985 – Why It’s Useful for Conditional Operators to Short-Circuit Evaluation
- #987 – The using Directive Can Create an Alias for a Type
- #988 – Using global to Explicitly Refer to a Namespace
- #989 – Formatting Numbers as Hexadecimal
- #990 – Converting Hexadecimal Strings to Numeric Data
- #994 – Unicode Basics
- #995 – Unicode Code Points
- #996 – UTF-16 Encoding, Part I
- #997 – UTF-16 Encoding, Part II
- #998 – UTF-8 Encoding
- #999 – Some Examples of UTF-16 and UTF-8 Encoding
- #1,000 – UTF-8 and ASCII
- #1,001 – Representing Unicode Surrogate Pairs
- #1,002 – Specifying Character Encoding when Writing to a File
- #1,017 – Delegate Types vs. Delegate Instances
- #1,018 – Delegate Invocation Syntax
- #1,019 – Syntax for Adding Methods to a Delegate’s Invocation List
- #1,020 – Removing Methods from a Delegate’s Invocation List
- #1,021 – What Happens to a Delegate’s Return Value
- #1,022 – How to Use Return Values from All Delegate Instances
- #1,077 – The Decimal Numeral System
- #1,078 – The Hexadecimal Numeral System
- #1,079 – The Binary Numeral System
- #1,080 – Binary Numerals Written as Hexadecimal
- #1,081 – Bits, Bytes and Nibbles
- #1,082 – Big-endian and Little-endian
- #1,083 – Using Visual Studio to Verify Little-Endianness
- #1,084 – Representing Numbers Using Scientific Notation
- #1,085 – Binary Floating Point Numbers
- #1,086 – Converting Decimal Floating Point to Binary Floating Point
- #1,087 – Representing Binary Floating Point Numbers Using Scientific Notation
- #1,088 – How 32-Bit Floating Point Numbers Are Stored in .NET, part I
- #1,089 – How 32-Bit Floating Point Numbers Are Stored in .NET, part II
- #1,090 – Using Visual Studio to Verify How Floating Point Numbers Are Stored
- #1,091 – Subnormal Floating Point Numbers
- #1,092 – Positive and Negative Zero
- #1,093 – How Positive and Negative Zero Values Are Stored
- #1,094 – Positive and Negative Infinity
- #1,095 – How Floating Point Infinity Values Are Stored
- #1,096 – Floating Point NaN Values
- #1,097 – Summary of how Floating Point Numbers Are Stored in .NET
- #1,098 – Floating Point Overflow
- #1,099 – Overloading the Increment Operator
- #1,102 – Scope vs. Declaration Space
- #1,103 – A Block Defines Both Scope and Declaration Space
- #1,104 – Can’t Re-Declare a Variable within a Nested Block
- #1,105 – Re-Declaring a Class-Level Variable within a Method
- #1,112 – How Integers Are Stored in .NET
- #1,113 – Addition of Integers Using Twos Complement
- #1,127 – Where to Find Compiler Warning Numbers
- #1,128 – Disable a Compile-Time Warning for Entire Project
- #1,149 – Generic Delegate Types
- #1,150 – Generic Delegate Type as Parameter
- #1,151 – The Func Delegate Type
- #1,152 – The Action Delegate Type
- #1,153 – Different Delegate Types Are Not Assignment Compatible
- #1,154 – Input Parameter Compatibility when Assigning to Delegate Types
- #1,155 – Return Value Compatibility when Assigning to Delegate Types
- #1,156 – Covariance and Generic Delegate Types
- #1,157 – Contravariance and Generic Delegate Types
Classes
- #141 – Implementing ICloneable for a Custom Type
- #143 – An Example of Implementing ICloneable for Deep Copies
- #144 – Using Serialization to Implement Deep Copying
- #226 – Classes and Objects
- #227 – Instances of Classes Are Created on the Heap
- #228 – Object-Oriented Programming in C# Using Classes
- #229 – The Core Principles of Object-Oriented Programming
- #230 – User-Defined Types Are First Class Citizens
- #231 – Declaring and Using Instance Fields in a Class
- #232 – Declaring and Using Instance Methods in a Class
- #233 – Returning a Result from an Instance Method
- #234 – Multiple return Statements
- #235 – return Statement Is Not Needed for void Methods
- #236 – Returning a Reference Type from a Method
- #237 – Referencing Class Fields from Within One of its Methods
- #238 – Call a Method from Another Method
- #239 – The this Reference
- #240 – Private and Public Instance Data in a Class
- #241 – Declaring and Using Private Instance Methods
- #242 – Declaring and Using a Property in a Class
- #243 – Property Get and Set Accessors
- #244 – Defining a Get Accessor for a Property
- #245 – Defining a Set Accessor for a Property
- #246 – Implementing a Read-Only Property
- #247 – Implementing a Write-Only Property
- #248 – Implementing a Property that Returns a Calculated Value
- #249 – Using a get Accessor to Clean up Property Data
- #250 – Using a set Accessor to Convert or Validate Property Data
- #251 – Class Properties Support the Principle of Encapsulation
- #252 – Automatic Properties
- #253 – Implementing a Read-Only Automatic Property
- #254 – Implementing a Read-Only Property with a Private Set Accessor
- #255 – Static Fields vs. Instance Fields
- #256 – Using Static Fields
- #257 – Private Static Fields
- #258 – Initializing a Static Variable as Part of Its Declaration
- #259 – Static vs. Instance Properties
- #260 – How Properties Look Under-the-Covers
- #261 – How Automatic Properties Look Under-the-Covers
- #262 – Passing Data to a Method Using Parameters
- #263 – A Method’s Signature Must Be Unique Within Its Type
- #285 – Class Member Overview
- #286 – A Constructor is Called When an Instance of a Class Is Created
- #287 – You Don’t Have to Define a Constructor
- #288 – Passing Arguments to a Constructor
- #289 – You Can Define Multiple Constructors
- #290 – Chaining Constructors
- #291 – No Default Constructor if You Define any Constructors
- #292 – A Static Constructor Initializes Static Data
- #293 – You Can Declare a Private Constructor
- #294 – Make All Constructors Private to Prevent Object Creation
- #295 – When Is a Static Constructor Called?
- #299 – Intellisense Shows You Available Constructors
- #303 – Accessibility of Class Members
- #304 – Private Class Members
- #305 – Public Class Members
- #306 – Protected Class Members
- #307 – Internal Class Members
- #308 – Protected Internal Class Members
- #309 – Accessing Protected Members In a Derived Class
- #310 – Accessibility of Fields in a Class
- #311 – Accessibility of Properties in a Class
- #312 – Accessibility of Methods in a Class
- #313 – Accessibility of Constructors in a Class
- #314 – Access Modifiers Are Not Allowed on Static Constructors
- #315 – Accessibility of Static Methods and Properties
- #322 – Class Accessibility
- #323 – A Generic Class is a Template for a Class
- #324 – A Generic Class Can Have More than One Type Parameter
- #325 – Intellisense Understands Generic Classes
- #326 – Generic Type vs. Constructed Type
- #329 – A Class Can Inherit Data and Behavior from Another Class
- #330 – Derived Classes Do Not Inherit Constructors
- #331 – Calling a Base Class Constructor Implicitly vs. Explicitly
- #332 – Every Class Inherits from Exactly One Class
- #333 – Class Inheritance Leads to a Hierarchy of Classes
- #334 – A Base Class Variable Can Refer to Instances of Derived Classes
- #335 – Accessing a Derived Class Using a Base Class Variable
- #336 – Declaring and Using a readonly Field
- #337 – Declaring and Using Static readonly Fields
- #338 – Static Readonly Fields vs. Constants
- #339 – Readonly Fields vs. Read-Only Properties
- #342 – Using a Static Variable to Count Instances of a Class
- #343 – Use the new Keyword to Replace a Method in a Base Class
- #344 – Hidden Base Class Member Is Invoked Based on Declared Type of Object
- #345 – Method in Derived Class Hides Base Class Method by Default
- #346 – Polymorphism
- #347 – Another Example of Polymorphism
- #348 – Virtual Methods Support Polymorphism
- #349 – The Difference Between Virtual and Non-Virtual Methods
- #350 – Method Modifiers Required for Polymorphic Behavior
- #351 – An Abstract Method Has No Implementation
- #352 – You Can’t Instantiate an Abstract Class
- #353 – Why You Might Define an Abstract Class
- #355 – Use the new Keyword to Replace a Property in a Base Class
- #356 – Hidden Base Class Property Is Used Based on Declared Type of Object
- #357 – Property in Derived Class Hides Base Class Property by Default
- #358 – Virtual Properties Support Polymorphism
- #359 – The Difference Between Virtual and Non-Virtual Properties
- #360 – Property Modifiers Required for Polymorphic Behavior
- #361 – An Abstract Property Has No Implementation
- #362 – Defining an Indexer
- #363 – An Indexer Can Have Both get and set Accessors
- #364 – Defining an Indexer whose Parameter Is an Enumerated Type
- #365 – Overloading an Indexer
- #366 – Defining an Indexer with More than One Parameter
- #517 – Static Classes
- #534 – What Good Are Generics?
- #546 – Specifying More than One Constraint for the Same Type Parameter
- #547 – Things That Can Serve as Type Parameter Constraints
- #548 – No More Than One Class for a Type Parameter Constraint
- #567 – Wider vs. Narrower Types
- #570 – Assignment Compatibility for Reference Types
- #590 – Optional Parameters in Constructors
- #601 – A Class Can Both Inherit from A Parent Class and Implement an Interface
- #602 – Initializing Fields in a Class
- #603 – Using Constants Can Force Recompilation
- #609 – Omit the Class Name for Static Members in the Same Class
- #610 – Lazy Evaluation in Property Get Accessors
- #614 – Subclass Accessibility
- #615 – You Can’t Remove a Base Class Member
- #616 – Base Class Needs to Know If Polymorphism Is Desired
- #617 – The Simplest Way to Call a Method in a Base Class
- #618 – Use the base Keyword to Call A Method in the Base Class
- #619 – Calling the Constructor in a Base Class
- #620 – Inherit from a Class In A Different Assembly
- #621 – Sealing a Class to Prevent Inheritance
- #622 – Sealing vs. Not Sealing
- #623 – Defining One Type Inside Another Type
- #624 – Accessibility of a Nested Class
- #625 – Reference a Nested Type Using Dot Notation
- #626 – Nested Type Options
- #627 – Accessibility of Nested Types in a struct or a class
- #628 – Why You Might Create a Nested Type
- #629 – Nested Types Have Full Access to Members in Parent
- #630 – Nested Type May Hide Member in Outer Class
- #631 – Code-Generation Tools and Partial Classes
- #639 – Static Class Can Contained Nested Non-Static Class
- #648 – Using an Object Initializer
- #649 – Creating an Anonymous Type
- #655 – Initializing Only Some Properties with An Object Initializer
- #656 – Nested Object Initializers
- #669 – Initializing Fields by Calling A Method
- #670 – Static vs. Instance Initialization
- #671 – A Base Class Constructor Can Call a Virtual Method
- #675 – Polymorphic Behavior Requires virtual / override Combination
- #676 – An Overridden Method Can Itself Be Overridden
- #677 – Method Marked with new Modifier Cannot Be Overridden
- #678 – A Sealed Method Cannot Be Overridden
- #679 – Hide An Inherited Method with A Virtual Method
- #680 – Virtual Modifier Combinations
- #681 – Avoid Using the new Keyword To Hide Methods
- #682 – The Real Reason for the new Keyword
- #683 – Two Ways an Object Can Behave Polymorphically
- #684 – Hidden Base Class Members Aren’t Really Hidden
- #685 – Inheritance Can Break Encapsulation
- #686 – Inheritance vs. Containment
- #687 – An Example of Containment
- #688 – Aggregation, Composition and Containment
- #690 – Using the this Keyword To Distinguish Between Fields and Parameters
- #692 – Two Approaches for Optional Parameters in Constructors
- #693 – Named Arguments in Constructors Allow the Most Flexibility
- #694 – Sequence of Events for Chained Constructors
- #696 – Using a Static Property to Count Instances
- #697 – Encapsulation is Managed through the Use of Access Modifiers
- #698 – Type Members Are Implicitly Private
- #699 – Types Are Implicitly Internal
- #700 – Using a set Accessor To Enforce Casing
- #701 – Centralize Business Rules Logic in set Accessors
- #702 – An Automatic Property Must Define Both get and set Accessors
- #703 – Object Initializers Allow Setting Either Fields or Properties
- #704 – Using an Object Initializer with Any Constructor
- #708 – A Name Must Be Unique Within A Declaration Space
- #715 – Private Members Are Not Visible in a Derived Class
- #716 – How Derived Classes Can Access Protected Members
- #717 – Class Members Can’t Be More Accessible Than Their Type
- #719 – Location of Declarations within A Class Doesn’t Matter
- #720 – Location of Declarations within A Method Does Matter
- #723 – New Methods in Subclass May Not Be Visible in Derived Classes
- #737 – When to Implement a Finalizer
- #739 – Avoid Accessing an Object After Its Been Finalized
- #741 – The Basics of Inheritance
- #742 – A Simple Example of Inheritance
- #744 – The Purpose of Inheritance
- #751 – Inheritance Only Partially Preserves Encapsulation
- #752 – C# Does Not Support Multiple Inheritance
- #753 – Implicitly Upcast to a Base Class Reference
- #754 – Downcast to a Reference to a Derived Class
- #768 – When to Call the Constructor of a Base Class
- #769 – Pattern – Call a Base Class Method When You Override It
- #783 – When to Create a Static Class
- #784 – When Not to Use a Static Class
- #787 – Avoid Public Fields in a Class
- #788 – A Backing Field Stores Data for a Property
- #790 – Property get and set Accessors Can Have Different Access Modifiers
- #791 – Properties Are Not Variables
- #795 – Rules for Creating an Immutable Class
- #796 – Default Accessibility for Property Accessors
- #797 – Setting Accessibility for Property Accessors
- #798 – You Can’t Override Accessors that Are Not Accessible
- #800 – A Property in an Interface May Include One or Two Accessors
- #801 – An Example of a Simple Immutable Class
- #817 – What Happens When a Static Constructor Throws an Exception
- #818 – What Happens When an Instance Constructor Throws an Exception
- #819 – A Private Constructor May Prevent Inheritance
- #820 – A Protected Constructor Allows a Subclass to Create Instances
- #824 – A Copy Constructor Makes a Copy of an Existing Object
- #825 – Shallow Copies
- #826 – Deep Copies
- #827 – Making a Deep Copy with a Copy Constructor
- #828 – Implementing Both a Copy Constructor and ICloneable
- #829 – Add Comments to Indicate Shallow vs. Deep Copying
- #830 – The Problem with ICloneable
- #831 – Implementing a Copy Constructor in a Derived Class
- #832 – The Sequence in Which Finalizers Are Called
- #1, 023 – Fields Are Initialized Before Execution of Constructors
- #1,024 – Exposing internal Members to Another Assembly
- #1,027 – Type Parameters vs. Type Arguments in a Generic Class
- #1,028 – Generic Types vs. Generic Methods
- #1,029 – How to Define a Constructor in a Generic Type
- #1,030 – Requiring Generic Type Parameters to Derive from a Specified Class
- #1,031 – Requiring Generic Type Parameters to Implement an Interface
- #1,032 – Requiring Generic Type Parameters to Be a Reference or Value Type
- #1,033 – Requiring a Generic Type Parameter to Have a Parameterless Constructor
- #1,034 – Making One Type Parameter Depend on Another
- #1,035 – Summary of Type Parameter Constraints
- #1,036 – Specifying Multiple Type Parameter Constraints
- #1,037 – Specifying Type Parameter Constraints for More than One Type Parameter
- #1,039 – Deriving from a Generic Class
- #1,040 – Deriving from a Constructed Type
- #1,041 – Adding New Type Parameters when You Derive from a Generic Class
- #1,042 – Deriving from a Self-Referencing Constructed Type, Part I
- #1,043 – Deriving from a Self-Referencing Constructed Type, part II
- #1,044 – How Static Data Behaves in Generic Types
- #1,070 – A Generic Type Can Be Compiled
- #1,134 – Use 「of」 Terminology for Generics
- #1,135 – Overloading a Generic Class
- #1,137 – Generic Methods in Non-Generic Classes
- #1,138 – Type Parameters in Generic Methods Can Be Constrained
- #1,139 – The Problem with Comparisons of Objects in Generic Types
- #1,140 – Comparing Reference-Typed Objects in Generic Types
- #1,141 – Reference Equality Used Even when Overload Available for Typed Parameter
- #1,142 – Using EqualityComparer to Compare Objects in Generic Types
- #1,143 – Implement IEquatable in a Generic Type
- #1,144 – Getting Type Information about a Generic Type
- #1,145 – Using Reflection on Generic Type Parameters
- #1,146 – Generics Don’t Support Covariance
- #1,147 – Why Generics Don’t Support Covariance
- #1,148 – When to Use a Generic Covariant Interface
Collections
Data Types
- #30 – Types, Variables, Values, Instances
- #31 – Value Types and Reference Types
- #32 – Built-In Types
- #34 – The object Type
- #37 – All Value Types Have a Default Constructor
- #38 – Data Type Hierarchy
- #39 – MinValue / MaxValue for Numeric Types
- #40 – TrueString and FalseString
- #41 – Instantiating Reference Types
- #42 – Interacting With an Object
- #43 – Objects Are Instantiated on the Heap
- #44 – Multiple References to the Same Object
- #47 – Numeric Conversions Through Casting
- #48 – How Explicit Casts Fail
- #49 – When to Use the Decimal Type
- #50 – Static Methods of System.Char
- #51 – Float Literals Must Use f Suffix
- #57 – Overflow on Integer Operations
- #58 – Generate Exceptions on Integer Overflow Using Checked Operator
- #59 – Using Unchecked Keyword to Avoid Overflow Exceptions
- #76 – Arithmetic Operations with Small Integers
- #80 – Use Decimal Type for Monetary Calculations
- #81 – DateTime and TimeSpan Types
- #82 – Some Common DateTime and TimeSpan Functions
- #93 – Escape Sequences in Character Literals
- #94 – Converting Between Char and Numeric Types
- #107 – Defining and Using a Struct
- #108 – Defining a Constructor for a Struct
- #109 – Defining and Using Enums
- #119 – Arrays
- #120 – Array Declaration and Instantiation
- #121 – Array Initialization
- #122 – Arrays Can Contain Any Type of Object
- #123 – Storing Arbitrary Objects in an Array
- #124 – Declaring and Instantiating Multidimensional Arrays
- #125 – Initializing Multidimensional Arrays
- #126 – Initializing Arrays of Reference-Type Objects
- #127 – Declaring and Instantiating Jagged Arrays
- #128 – Accessing Elements in Jagged Arrays
- #129 – Initializing Jagged Arrays
- #130 – Default Values of Array Elements
- #131 – Arrays Derive from System.Array
- #132 – Arrays That Are Both Multidimensional and Jagged
- #133 – An Array’s Length is Fixed
- #134 – Sorting One-Dimensional Arrays
- #135 – Implement IComparable to Allow Sorting a Custom Type
- #136 – Sorting an Array of Values Based on an Array of Keys
- #137 – Sorting an Array Using an Independent Comparer Method
- #138 – Searching a Sorted Array
- #139 – Using the Array.Clone Method to Make a Shallow Copy of an Array
- #140 – Making a Deep Copy of an Array Using an Object’s Clone Method
- #142 – Implement ICloneable All the Way Down for Deep Copies
- #145 – Using Array.Find to Search an Unsorted Array
- #146 – Using Array.FindAll to Find a Set of Matching Elements in an Array
- #147 – Getting the Average of an Array of Numbers
- #148 – Getting the Average of an Array of Custom Objects
- #149 – Using IEnumerable.Aggregate to Perform a Calculation Based on All Elements in an Array
- #150 – Other Aggregate Functions You Can Apply to Numeric Arrays
- #151 – Determining Whether an Array Contains a Specific Element
- #152 – Remove Duplicate Array Entries Using Distinct() Method
- #153 – Returning a Subset of Array Elements Matching a Particular Criteria
- #154 – Using an Invalid Array Index Causes an Exception to Be Thrown
- #155 – Iterating Through An Array Using the foreach Statement
- #156 – Using break and continue in foreach Loops
- #191 – Changing the Underlying Type of an enum
- #192 – Using Non-Default Constant Values for Enumeration Members
- #193 – An Enum Type’s ToString Method Displays the Member’s Name
- #194 – Storing a Set of Boolean Values as Bits
- #195 – Using an Enum Type to Store a Set of Flags
- #196 – Using the ToString() Method on a Flags-Based Enum Type
- #197 – Checking an Enumerated Value for the Presence of a Flag
- #198 – Enumeration Values That Set Combinations of Flags
- #203 – It’s Good Practice to Always Have a 0-Valued Enumeration Constant
- #210 – Checking to See Whether a Nullable Object Has a Value
- #211 – Using the Null-Coalescing (??) Operator
- #212 – Using Several Null-Coalescing (??) Operators in the Same Expression
- #213 – Final Operand When Using Null-Coalescing (??) Operator
- #214 – Using the Null-Coalescing (??) Operator with Reference Types
- #215 – Using the Null-Coalescing (??) Operator with Custom Nullable Types
- #216 – Null-Coalescing (??) Operator Is Equivalent to GetValueOrDefault Method
- #217 – T? Is Equivalent to Nullable<T>
- #218 – Store Value-Typed Objects on the Heap Through Boxing
- #219 – Unboxing a Boxed Object
- #220 – Boxing Can Happen Automatically
- #221 – When Unboxing, You Must Match the Original Type Exactly
- #280 – Implicitly-Typed Arrays
- #296 – You Must Assign a Value to All Fields Before Using a struct
- #297 – Three Different Ways to Initialize the Contents of a struct
- #298 – A struct Can Have Several Constructors
- #316 – Declaring and Using Constants
- #317 – Constants Can Be Class Members
- #318 – You Can’t Use the static Modifier On a Constant
- #319 – You Initialize a Constant Using an Expression
- #320 – The Constant Expression for a Reference-Typed Constant Must Be Null
- #321 – Accessibility of Constants
- #327 – Assigning a struct to a New Variable Makes a Copy
- #328 – Copying a struct Will Not Copy Underlying Reference Types
- #367 – Iterating through All Possible Values of an Enumeration Type
- #433 – All structs Inherit from System.ValueType
- #457 – Converting Between enums and their Underlying Type
- #458 – Errors While Converting Between enum and Underlying Type
- #459 – Assigning a Value of a Different Type to an enum
- #460 – Converting from a String to an Enum Type
- #461 – Enumeration Elements Don’t Need to Be Sequential
- #462 – Duplicate Enumerators in an Enumerated Type
- #463 – Enumerated Values Can Be Any Constant Expression
- #464 – Getting an Enumeration’s Underlying Type at Runtime
- #465 – Dumping All Names and Values for an Enumerated Type
- #466 – Explicitly Assigning Only Some Enumerated Values
- #477 – Full List of Escape Sequences for Character Literals
- #510 – Declaring More than One Local Variable On the Same Line
- #519 – Differences Between structs and classes
- #520 – Choosing Between a struct and a Class
- #566 – Implicit Conversions to Nullable Types
- #568 – Array Covariance
- #569 – Assignment Compatibility
- #571 – Covariance in Programming Languages
- #572 – Why Array Covariance Is Called Covariance
- #573 – Array Covariance Doesn’t Apply to Value Types
- #574 – The Problem with Array Covariance
- #581 – Boxing and Unboxing Nullable Types
- #582 – Use the as Operator to Unbox to a Nullable Type
- #596 – Implicitly-Typed Arrays and Best Type Inference
- #598 – Clearing an Array or a Subset of an Array
- #599 – Copying an Array Onto Another Array
- #600 – Reversing the Elements in an Array
- #611 – Accessibility of Members in a struct
- #641 – Using the this Keyword in a struct
- #642 – Reassigning the this Pointer in a struct
- #643 – The Constructor for a struct Must Initialize All Data Members
- #644 – Chaining struct Constructors
- #645 – You Can Chain to the Default Constructor for a struct
- #646 – Value Types Don’t Have Finalizers
- #650 – Creating an Array of Anonymously-Typed Objects
- #651 – Passing an Anonymously-Typed Object to a Method
- #652 – Using Expressions and Variables in Anonymous Type Declarations
- #653 – Projection Initializers
- #654 – You Can’t Use an Anonymous Type Directly
- #657 – Boxing Makes a Copy of An Object
- #658 – What Boxing and Unboxing Look Like in IL
- #767 – A struct Is Implicitly Sealed
- #775 – Copying an Array of Anonymously-Typed Objects
- #776 – Declaring and Using Nullable structs
- #777 – A struct Isn’t Mutable When Used as a Property
- #778 – A struct Isn’t Mutable When Used in a Collection
- #779 – Methods in struct that Modify Elements Can Be Dangerous
- #780 – The Case for Immutable structs
- #781 – A struct Can Implement an Interface
- #782 – You Can Create an Instance of a struct Without the new Keyword
- #789 – Grouping Constants into Their Own Class
- #833 – Some Examples of Anonymous Object Initializers
- #834 – Use a Generic List to Store a Collection of Objects
- #835 – A Generic List Can Store Value-Typed or Reference-Typed Objects
- #836 – Initializing a Generic List with an Object Initializer
- #837 – Object Initializers within Collection Initializers
- #838 – Object and Collection Initializers as Parameters
- #839 – Anonymous Type Limitations
- #840 – Use an Anonymous Type as a Read-Only Subset of an Object
- #982 – An Enum Type Can Store a Maximum of 32 Flags
- #983 – Using a BitArray to Store a Large Collection of Boolean Values
- #991 – Using the Round-Trip Format Specifier
- #992 – The System.Char Data Type
- #993 – Some Examples of Characters
- #1,012 – Options for Array Declaration, Instantiation and Initialization
- #1,013 – default Operator Returns Default Values
- #1,014 – Using default Operator in a Generic Class
- #1,015 – Rendering a Byte Array as a Series of Hex Characters
- #1,016 – Retrieving the Length of an Array
- #1,025 – Converting between enum Types
- #1,026 – Checking a Flagged enum Type for Validity
- #1,045 – Implicit Conversions When Assigning from a Nullable Type
- #1,046 – Implicit vs. Explicit Conversions
- #1,047 – The Implicit Identity Conversion
- #1,048 – No Implicit Conversions between Signed vs. Unsigned
- #1,049 – Full List of Implicit Numeric Conversions
- #1,050 – Implicit Conversions between Nullable Types
- #1,051 – Implicit Reference Conversions
- #1,052 – Boxing Is a Kind of Implicit Conversion
- #1,053 – Implicit Conversion from Type dynamic
- #1,054 – Implicit Conversions from Constant Expressions
- #1,055 – Defining Your Own Implicit Conversions
- #1,056 – Custom Implicit Conversions between Reference Types
- #1,057 – Custom Explicit Conversions
- #1,058 – Custom Implicit Conversions in Both Directions
- #1,059 – Converting from Numeric to Enumerated Types
- #1,060 – Explicit Conversions between Nullable Types
- #1,061 – Explicit Reference Conversions
- #1,062 – Unboxing Conversions
- #1,063 – Explicit Conversions and Type Parameters
- #1,064 – Getting Around Inability to Explicitly Convert Type Parameters
- #1,065 – Cases When Array Covariance Doesn’t Work
- #1,066 – Constraining a Type Parameter on a Generic Interface
- #1,076 – Implicit Numeric Conversions from the char Type
- #1,111 – Converting an Integer to a String in a Different Base
- #1,198 – Using Operators with Nullable Types
- #1,199 – Equality and Inequality with Nullable Types
Debugging
Enumeration
Events
Exceptions
Input/Output
Interfaces
Memory
Methods
- #264 – By Default, Parameters Are Passed by Value
- #265 – Passing Reference Types by Value
- #266 – You Can’t Prevent a Method from Changing the Contents of Reference Types
- #267 – Passing Data Back from a Method Using out Parameters
- #268 – You Must Set the Value of All out Parameters Before Returning from a Method
- #269 – Use ref Modifier on Parameters that Are Input/Output
- #270 – Passing a Reference Type by Reference
- #271 – Passing a Reference Type as an Output Parameter
- #272 – Differences Between ref and out Parameters
- #273 – Parameter Modifier Summary
- #274 – Can’t Overload if Methods Differ Only by ref and out Modifiers
- #275 – Passing a struct to a Method
- #276 – Passing a struct by Reference
- #277 – Passing an Array to a Method
- #278 – Passing an Array by Reference
- #279 – Passing a Multidimensional Array to a Method
- #281 – Declaring and Using Static Methods in a Class
- #282 – Creating Private Static Methods
- #283 – Instance Methods Can Call Static Methods
- #284 – Static Methods Can Call Instance Methods
- #340 – Use the params Keyword to Pass a Variable Number of Arguments
- #341 – Defining and Using Local Variables
- #354 – Correct Overloaded Method Is Automatically Called
- #511 – Rules for Using Parameter Arrays
- #512 – Two Ways to Pass Data to a Method that Takes a Parameter Array
- #513 – Some Familiar Methods that Accept Parameter Arrays
- #538 – Implement a Generic Method
- #539 – Type Inference When Calling Generic Methods
- #540 – Non-Generic Methods in a Generic Class
- #541 – Generic Method Type Parameters Can Hide Class-Level Type Parameters
- #549 – Anonymous Method Basics
- #553 – Anonymous Methods as Static or Instance Methods
- #554 – Rules for Matching an Anonymous Method to a Delegate Type
- #584 – Defining an Optional Parameter
- #585 – Optional Parameters Must Come Last
- #586 – Default Values for Optional Parameters Must Be Constants
- #587 – If Provided, Optional Arguments Must Be in Correct Order
- #588 – A Default Parameter Value Can Be Null
- #589 – Optional Parameters Must Be Input Parameters
- #593 – Using Named Arguments
- #594 – When You’d Want to Use Named Arguments
- #597 – Returning an Array from a Method
- #608 – Instance Methods Can Use Static Data
- #632 – Partial Methods
- #633 – The Implementation of A Partial Method Is Optional
- #634 – Invoking Partial Methods That Have No Implementation
- #635 – Limitations on Partial Methods
- #636 – The Reason for Partial Methods
- #637 – A Delegate Can Refer to A Partial Method
- #638 – Defining and Using a Partial struct
- #674 – Can Overload If Parameters Differ Only by ref Modifier
- #695 – Static Methods Can Access Static Members
- #772 – Initializing an Array as Part of a Method Call
- #774 – Passing an Array as an out Parameter
- #802 – A Method Might Have No Parameters
- #807 – Defining and Using an Extension Method
- #808 – Adding Parameters to an Extension Method
- #809 – Extension Method Signatures Shouldn’t Match Class Methods
- #810 – Where Extension Methods Came From
- #811 – Extension Methods Can Only Access Public Members of Class
- #812 – Defining an Extension Method for a Value Type
- #813 – Defining an Extension Method for an Enumerated Type
- #814 – Parameters vs. Arguments
- #815 – Named vs. Positional Arguments
- #816 – Named Argument and Optional Parameter Combinations
- #1,038 – Type Parameter Constraints on Generic Methods
- #1,136 – Overloading a Generic Method
- #1,165 – Lambda Expression Basics
- #1,166 – Lambda Expression Syntax
- #1,167 – Passing a Lambda Expression to a Method
- #1,168 – Using a Lambda Expression as an Event Handler
- #1,169 – Lambdas Supersede Anonymous Methods
- #1,170 – You Can’t Unsubscribe from an Event Using a Lambda Expression
- #1,171 – Lambda Expression Internals
- #1,172 – Lambda Expressions Often Used with Func and Action
- #1,173 – Lambda Expression Can Be Just an Expression
- #1,174 – Assigning a Lambda Expression to an Expression Tree
- #1,175 – An Example of an Expression Tree
- #1,176 – How an Expression Tree is Stored in Memory
- #1,177 – Lambda Expressions Can Reference Variables Declared Outside of Expression
- #1,178 – Captured Variables Are Evaluted when a Delegate Is Invoked
- #1,179 – Captured Variable’s Lifetime Matches Delegate
- #1,180 – Lambda Expressions Can Modify Captured Variables
- #1,181 – Instantiating an Object within a Lambda Expression
- #1,182 – Capturing a for Loop Variable in a Lambda Expression
- #1,183 – How to Correctly Capture a for Loop Variable in a Lambda Expression
- #1,186 – Capturing a foreach Iteration Variable in a Lambda Expression
- #1,187 – Using a Lambda Expression When Adding to an Invocation List
- #1,188 – Lambda Expression Can Capture Instance Data
- #1,189 – Lambda Expression Can Capture Static Data
- #1,190 – A Lambda Expression Can Be Recursive
- #1,191 – Lambda Can’t Capture ref or out Parameters
Miscellaneous
- #453 – Use Reflection to Get a List of Interfaces that a Class Implements
- #480 – Pre-Processing Directives
- #725 – Dumping Out a List of Types in an Assembly
- #726 – Listing all Types within a Namespace
- #727 – Get a List of All Namespaces in an Assembly
- #728 – Dumping Out All Types in the .NET Framework
- #729 – Dumping Out All Types in .NET Framework, part II
- #731 – Getting Information About the Members of a Class
- #743 – ASCII Art Generator
- #745 – Use ReSharper to Increase Your Productivity in Visual Studio
- #748 – Use GhostDoc Tool to Document Your Code
- #749 – Example of Some C# Design Patterns
- #750 – Use xUnit.net for Unit Testing
- #757 – Books on Object-Oriented Programming
- #942 – The Case for Lazy Instantiation
- #943 – Lazy Instantiation, Solution #1
- #944 – Lazy Instantiation, Solution #2
- #945 – Lazy Instantiation, an Easier Solution
- #946 – Specifying Whether Lazy Instantiated Object Should Be Thread-Safe
- #947 – Specifying Lazy Instantiation Using a Lambda Expression
- #984 – The Birthday Problem
- #1,101 – Mathematical Constants
- #1,202 – C# 6.0 – Null-Conditional Operator
- #1,203 – C# 6.0 – Using the Null-Conditional with Value Types
- #1,204 – C# 6.0 – Using Null-Conditional with Indexer
- #1,205 – C# 6.0 – Using the Null-Conditional when Invoking a Delegate
- #1,206 – C# 6.0 – Auto-Property Initializers
- #1,207 – C# 6.0 – Auto-Property Initializers for Read-Only Properties
- #1,208 – C# 6.0 – Auto-Property Initializers Can Be Any Expression
- #1,209 – C# 6.0 – Using the nameof Operator
- #1,210 – C# 6.0 – Primary Constructors
- #1,211 – C# 6.0 – Adding Implementation for a Primary Constructor
- #1,212 – List of Features Shipping in C# 6.0
- #1,214 – C# 6.0 – using Directive with Static Class
- #1,215 – C# 6.0 – New Syntax for Dictionary Initializers
- #1,216 – C# 6.0 – Initializing Read-Only Auto-Properties from Constructors
- #1,217 – C# 6.0 – Using Lambda Expressions for Function Members
- #1,218 – C# 6.0 – Using Lambdas for Getter-Only Auto-Properties
- #1,219 – C# 6.0 – Filtering Exceptions
Operators
- #396 – Operators as Class Members
- #397 – Defining an Operator
- #398 – Overloadable Operators
- #399 – Overloading Unary Operators
- #400 – Overloading Binary Operators
- #405 – Equals Method for Equivalence, == Operator for Identity
- #408 – Overloading the == Operator for a Reference Type
- #409 – Example of Overloading the == Operator
- #410 – Overloading the == Operator for a Value Type
- #412 – Guidelines when Overloading == Operator for a Value Type
- #414 – Equivalence Can Be Based on a Subset of Fields
- #415 – Be Careful When Checking Floating Point Numbers for Equality
- #416 – Use an Epsilon to Compare Two Floating Point Numbers
- #419 – Override Relational Operators When You Implement IComparable
- #575 – Using the is Operator to Check the Type of a Reference-Typed Object
- #576 – Using the is Operator with Value Typed Objects
- #577 – Using the is Operator to Check for an Unboxing Conversion
- #578 – Using the as Operator to Do Type Conversions
- #579 – Typical Pattern for Using as Operator
- #580 – as Operator Can Generate Compile-Time Errors
- #592 – Optional Parameters in Indexers
- #1,071 – The Unary Minus Operator
- #1,072 – How the Unary Minus Operator Can Fail
- #1,073 – Arithmetic Binary Operators are Left-Associative
- #1,074 – Use Parentheses in Expressions to Make Code More Readable
- #1,075 – Operator Precedence Doesn’t Affect Operand Evaluation Order
- #1,100 – Increment and Decrement Operators Are Not Thread-Safe
- #1,106 – Using the Logical Exclusive OR Operator
- #1,107 – The Bitwise AND Operator
- #1,108 – The Bitwise OR Operator
- #1,109 – The Bitwise NOT Operator
- #1,110 – The Bitwise Exclusive OR Operator
- #1,114 – Don’t Use Shift Operators to Do Multiplication
- #1,200 – Logical Operators vs. Conditional Logical Operators
- #1,201 – Writing Conditional Logical Operators as Conditionals
Patterns
Security
Statements
- #157 – Iterating Using the while Loop
- #158 – A while Loop Expression Is Evaluated Before Executing the Loop
- #159 – A while Loop Might Execute Forever
- #160 – A while Loop Can Exit on break, goto, return or throw Statements
- #161 – Use continue to Jump to Next Iteration of while Loop
- #162 – do/while Loop Executes at Least Once
- #163 – Iterating Using the for Loop
- #164 – for Loop Clauses Can Contain Lists of Statements
- #165 – Any Clause of the for Loop May Be Left Empty
- #166 – Using the for Statement to Create an Infinite Loop
- #167 – Use continue to Jump to Next Iteration of for Loop
- #168 – Use if Statement to Conditionally Execute a Block of Code
- #169 – The if Statement Must Always Include a Boolean Expression
- #170 – The else Portion of an if Statement
- #171 – if/else Statement Can Have One or More Statements in Body
- #172 – Nested if Statements
- #173 – The switch Statement
- #174 – Multiple Case Statements in switch Statement Can Share Code
- #175 – The default Clause of a switch Statement
- #176 – Switch Statement Doesn’t Fall Through from Case to Case
- #177 – Using goto in a switch Statement
- #178 – Throwing an Exception from a switch Statement
- #986 – Using goto to Jump to a Label
- #1,115 – Iterating Through a Collection Using the foreach Statement
- #1,119 – Scope of Iteration Variable Is Limited to Body of foreach
- #1,120 – The Iteration Variable in a foreach Loop Is Read-Only
- #1,121 – Modifying Elements in a Collection Using foreach
- #1,122 – It’s Okay to Capture Variables within a foreach Loop
- #1,123 – Using foreach to Iterate on a Multidimensional Array
- #1,124 – Iterate through Jagged Array with Nested foreach
- #1,125 – Use of break and continue Statements
- #1,126 – Rewriting a Loop to Avoid continue Statement
Strings
- #14 – Composite Format Strings in C#
- #15 – Using Long Lists of Format Items in Composite Format Strings
- #16 – Use an Array of Objects for a Composite Format String
- #17 – Methods that Support Composite Formatting
- #25 – String Literals
- #33 – The string Type
- #60 – Using Parse to Convert from String to Numeric Types
- #61- Formatting and Parsing Strings for Non-Default Cultures
- #62 – String Concatenation
- #63 – Use StringBuilder for More Efficient String Concatenation
- #64 – Escape Sequences in String Literals
- #65 – Verbatim String Literals
- #66 – Including Quotation Marks in Strings
- #68 – String Equality
- #69 – Strings are Immutable
- #70 – The StringBuilder Class
- #71 – StringBuilder Capacity
- #95 – ToString() Called Automatically When Doing String Concatenation
- #96 – Comparing String Values
- #97 – String Comparisons Using Other Cultures
- #98 – Using An Indexer to Get A Specific Character in A String
- #99 – Use StringInfo to Get Specific Characters From A UTF32 String
- #100 – Using IndexOf to Search for Characters Within A String
- #101 – Use Contains() to Discover If A String Contains Other Strings
- #102 – Use Substring() to Extract Substrings From A String
- #103 – Inserting and Removing Substrings
- #104 – Functions to Trim Leading and Trailing Characters From A String
- #105 – Chaining String Functions Together
- #106 – Using String.Split to Parse A String Into Substrings
- #392 – Reversing a String Using the Reverse Method
- #422 – How ReferenceEquals Behaves When Comparing Strings
- #478 – Verbatim String Literals Can Span Multiple Lines
- #479 – Identical String Literals Are Stored in the Same Object
- #773 – Reversing a String that Contains Unicode Characters Expressed as Surrogate Pairs
- #970 – Checking for Valid Characters in a String
- #1,003 – Accessing Underlying Bytes in a String for Different Encodings
- #1,004 – Converting a String to Uppercase or Lowercase
- #1,005 – Replacing a Substring with a New Substring
- #1,006 – Getting the Length of a String
- #1,007 – Getting Length of String that Contains Surrogate Pairs
- #1,008 – What Happens When You Forget That Strings Are Immutable
- #1,009 – A String Can Be Null or Empty
- #1,010 – Checking to See Whether a String is Null or Empty
- #1,011 – TryParse Indicates Whether a Parse Operation Will Succeed
- #1,116 – Iterating Through a String Using the foreach Statement
Visual Studio
|