C#idiomatic C#
language337 pages

idiomatic C#

Language

C# as a language: syntax, types, statements, and the conventions the team ships in the box.

  1. System.Delegate and the `delegate` keyword 06/20/2016
  2. Introduction to delegates and events in C# 03/24/2022
  3. Common patterns for delegates 06/20/2016
  4. Strongly Typed Delegates 06/20/2016
  5. Delegates vs. events 03/11/2025
  6. Standard .NET event patterns 03/13/2025
  7. Introduction to events 03/11/2025
  8. Common C# code conventions 01/15/2025
  9. C# identifier naming rules and conventions 10/10/2025
  10. Compiler-generated exceptions 05/14/2021
  11. Create and throw exceptions 10/31/2023
  12. Exception Handling (C# Programming Guide) 05/14/2021
  13. How to execute cleanup code using finally 05/14/2021
  14. How to handle an exception using try/catch 05/14/2021
  15. Exceptions and Exception Handling 05/14/2021
  16. Use exceptions 05/14/2021
  17. C# Equality comparisons 08/18/2026
  18. C# expressions 08/13/2026
  19. C# operators 08/18/2026
  20. Deconstructing tuples and other types 11/22/2024
  21. Resolve nullable warnings 05/04/2026
  22. C# null safety 04/30/2026
  23. C# null operators 04/30/2026
  24. Nullable reference types 05/04/2026
  25. Nullable value types: C# Fundamentals 04/30/2026
  26. Overview of object oriented techniques in C# 04/17/2025
  27. Inheritance - derive types to create more specialized behavior 05/14/2021
  28. Objects - create instances of types 10/13/2025
  29. Polymorphism 10/13/2025
  30. Declaration, constant, and `var` patterns 09/15/2026
  31. Discards and the discard pattern 09/17/2026
  32. Pattern matching overview 09/14/2026
  33. Type patterns 09/15/2026
  34. General structure of a C# program 03/16/2026
  35. Main() and command-line arguments 03/16/2026
  36. Namespaces and using directives 03/16/2026
  37. Preprocessor directives 03/16/2026
  38. Program organization 03/16/2026
  39. Top-level statements - programs without `Main` methods 03/16/2026
  40. Common collection types 07/15/2026
  41. C# statements 08/20/2026
  42. Iteration statements 07/09/2026
  43. LINQ queries 07/15/2026
  44. Selection statements 08/20/2026
  45. Compare strings in C# 06/24/2026
  46. Concatenate strings in C# 06/24/2026
  47. Modify string contents in C# 06/24/2026
  48. Search strings in C# 05/21/2026
  49. Split strings into substrings in C# 05/21/2026
  50. C# strings 05/08/2026
  51. String interpolation in C# 05/21/2026
  52. The `nameof` operator 05/08/2026
  53. Raw string literals 05/08/2026
  54. Tutorial: Choose between tuples, records, structs, and classes 04/30/2026
  55. Explore object oriented programming with classes and objects 10/10/2025
  56. Tutorial: Build file-based C# programs 01/12/2026
  57. How to display command-line arguments 02/25/2022
  58. Inheritance in C# and .NET 02/25/2022
  59. Tutorial: Express your design intent with nullable and non-nullable reference types 05/04/2026
  60. Object-Oriented programming 10/10/2025
  61. Tutorial: Use pattern matching to build type-driven and data-driven algorithms 02/25/2022
  62. Use record types 04/14/2026
  63. How to safely cast by using pattern matching and the is and as operators 02/25/2022
  64. Tutorial: Use string interpolation to build a report in C# 06/24/2026
  65. Tutorial: Build a command-line app with System.CommandLine 03/23/2026
  66. Tutorial: Create XML documentation 10/14/2025
  67. Built-in types and literals 03/24/2026
  68. C# classes 03/25/2026
  69. Type conversions, casting, and boxing 04/14/2026
  70. Lambda expressions, delegates, and events 04/27/2026
  71. C# enumerations 04/10/2026
  72. Generic types and methods 04/10/2026
  73. The C# type system 03/24/2026
  74. Interfaces - define behavior for multiple types 04/10/2026
  75. C# record types 03/25/2026
  76. C# structs 03/25/2026
  77. Tuples and deconstruction 04/10/2026
  78. Iterators 11/09/2021
  79. Determine caller information by using attributes that the C# compiler interprets 01/14/2026
  80. Miscellaneous attributes interpreted by the C# compiler 02/17/2026
  81. Assembly level attributes interpreted by the C# compiler 01/14/2026
  82. Attributes for null-state static analysis interpreted by the C# compiler 01/14/2026
  83. Custom attributes that generate flags or options in the Intermediate Language (IL) output 02/17/2026
  84. Arrays 01/14/2026
  85. bool (C# reference) 01/14/2026
  86. Built-in types (C# reference) 01/14/2026
  87. char (C# reference) 01/14/2026
  88. Collections 01/14/2026
  89. Default values of C# types (C# reference) 01/14/2026
  90. Enumeration types (C# reference) 01/14/2026
  91. Floating-point numeric types (C# reference) 01/14/2026
  92. Integral numeric types (C# reference) 01/14/2026
  93. Nullable reference types (C# reference) 05/15/2026
  94. Nullable value types (C# reference) 01/14/2026
  95. Built-in numeric conversions (C# reference) 01/14/2026
  96. Records (C# reference) 06/05/2026
  97. `ref` structure types (C# reference) 01/14/2026
  98. Built-in reference types (C# reference) 01/14/2026
  99. String operations: Pattern matching, performance, and span-based search 05/21/2026
  100. Structure types (C# reference) 01/14/2026
  101. Union types (C# reference) 08/14/2026
  102. Unmanaged types (C# reference) 01/14/2026
  103. Tuple types (C# reference) 01/14/2026
  104. Value types (C# reference) 03/20/2026
  105. void (C# reference) 01/14/2026
  106. Configure C# language version 01/16/2026
  107. abstract (C# Reference) 06/06/2026
  108. Access modifiers (C# reference) 01/21/2026
  109. Accessibility domain (C# reference) 01/21/2026
  110. Accessibility levels (C# reference) 01/21/2026
  111. The `add` contextual keyword (C# Reference) 01/21/2026
  112. ascending (C# Reference) 01/21/2026
  113. async (C# reference) 01/21/2026
  114. The base keyword 01/21/2026
  115. by (C# Reference) 01/21/2026
  116. class (C# Reference) 01/21/2026
  117. closed (C# Reference) 08/14/2026
  118. The const keyword 01/21/2026
  119. default (C# reference) 01/21/2026
  120. descending (C# Reference) 01/21/2026
  121. equals (C# Reference) 01/21/2026
  122. The `event` keyword (C# reference) 01/21/2026
  123. Extension declaration (C# Reference) 07/08/2026
  124. extern alias (C# Reference) 01/21/2026
  125. extern (C# Reference) 01/21/2026
  126. `field` - Field backed property declarations 01/21/2026
  127. The file modifier 01/21/2026
  128. from clause (C# Reference) 01/21/2026
  129. The `get` keyword 01/21/2026
  130. group clause (C# Reference) 01/21/2026
  131. `in` (Generic Modifier) (C# Reference) 01/21/2026
  132. `in` (C# reference) 01/21/2026
  133. C# keywords 06/05/2026
  134. The `init` keyword (C# Reference) 01/21/2026
  135. interface (C# Reference) 01/21/2026
  136. internal (C# reference) 01/21/2026
  137. into (C# Reference) 01/21/2026
  138. join clause (C# Reference) 01/21/2026
  139. `let` clause (C# Reference) 01/21/2026
  140. Method parameters and modifiers 01/22/2026
  141. The `namespace` keyword 01/22/2026
  142. new constraint (C# Reference) 01/22/2026
  143. new modifier (C# Reference) 01/22/2026
  144. new (C# reference) 01/22/2026
  145. null (C# Reference) 01/22/2026
  146. on (C# Reference) 01/22/2026
  147. orderby clause (C# Reference) 01/22/2026
  148. out (generic modifier) (C# Reference) 01/22/2026
  149. out (C# Reference) 01/22/2026
  150. override (C# reference) 01/22/2026
  151. Partial member (C# Reference) 01/22/2026
  152. Partial type (C# Reference) 01/22/2026
  153. private protected (C# Reference) 01/22/2026
  154. private (C# Reference) 01/22/2026
  155. protected internal (C# reference) 01/22/2026
  156. protected (C# Reference) 01/22/2026
  157. public (C# reference) 01/22/2026
  158. Query keywords (C# Reference) 01/22/2026
  159. readonly (C# reference) 01/22/2026
  160. The `ref` keyword 01/22/2026
  161. Reference types (C# reference) 01/22/2026
  162. The `remove` contextual keyword (C# Reference) 01/22/2026
  163. required modifier (C# Reference) 01/22/2026
  164. Restrictions on using accessibility levels (C# Reference) 01/22/2026
  165. safe (C# Reference) 09/11/2026
  166. sealed (C# Reference) 06/05/2026
  167. select clause (C# Reference) 01/22/2026
  168. The set keyword (C# Reference) 01/22/2026
  169. Statement keywords (C# Reference) 01/22/2026
  170. static (C# Reference) 01/22/2026
  171. The this keyword 01/22/2026
  172. unsafe (C# Reference) 09/10/2026
  173. The `using` directive 01/22/2026
  174. using (C# reference) 01/22/2026
  175. The `value` implicit parameter 10/30/2024
  176. virtual (C# Reference) 01/22/2026
  177. volatile (C# Reference) 01/22/2026
  178. when (C# reference) 01/22/2026
  179. where clause (C# Reference) 01/22/2026
  180. where (generic type constraint) (C# Reference) 01/22/2026
  181. `with` (C# reference) 02/06/2026
  182. C# language versioning 02/04/2026
  183. Addition operators - `+` and `+=` 01/20/2026
  184. Arithmetic operators (C# reference) 01/20/2026
  185. Assignment operators (C# reference) 01/20/2026
  186. await operator - asynchronously await for a task to complete 09/11/2026
  187. Bitwise and shift operators (C# reference) 01/20/2026
  188. Boolean logical operators - AND, OR, NOT, XOR 01/20/2026
  189. Collection expressions - C# language reference 08/14/2026
  190. Comparison operators (C# reference) 01/20/2026
  191. ?: operator - the ternary conditional operator 01/20/2026
  192. Deconstruction expression - Extract properties of fields from a tuple or other user-defined type 01/20/2026
  193. Default value expressions 01/20/2026
  194. delegate operator 01/20/2026
  195. Equality operators - test if two objects are equal or not 08/19/2026
  196. C# operators and expressions 01/20/2026
  197. The `is` operator (C# reference) 01/20/2026
  198. Lambda expressions and anonymous functions 01/20/2026
  199. Lambda expression (`=>`) operator defines a lambda expression 08/20/2026
  200. Member access operators and expressions - the dot, indexer, and invocation operators 01/20/2026
  201. nameof expression (C# reference) 01/20/2026
  202. :: operator - the namespace alias operator 01/20/2026
  203. new operator - The `new` operator creates a new instance of a type 01/20/2026
  204. `??` and `??=` operators - the null-coalescing operators 01/20/2026
  205. ! (null-forgiving) operator (C# reference) 01/20/2026
  206. Operator overloading - predefined unary, arithmetic, equality, and comparison operators 01/20/2026
  207. Pattern matching - the `is` and `switch` expressions, and operators `and`, `or`, and `not` in patterns 08/14/2026
  208. Pointer related operators - take the address of variables, dereference storage locations, and access memory locations 06/16/2026
  209. sizeof operator - determine the memory needs for a given type 06/29/2026
  210. stackalloc expression (C# reference) 06/16/2026
  211. - and -= operators - subtraction (minus) 01/20/2026
  212. `switch` expression - pattern matching expressions using the `switch` keyword 03/20/2026
  213. True and false operators 01/20/2026
  214. Type-testing operators and cast expressions - `is`, `as`, `typeof`, and casts 01/20/2026
  215. User-defined explicit and implicit conversion operators 01/20/2026
  216. The `with` expression - Nondestructive mutation creates a new object with modified properties 01/20/2026
  217. C# preprocessor directives 01/16/2026
  218. The checked and unchecked statements (C# reference) 01/16/2026
  219. Declaration statements 01/16/2026
  220. Exception-handling statements - `throw`, `try-catch`, `try-finally`, and `try-catch-finally` 01/16/2026
  221. fixed statement - pin a variable for pointer operations 06/16/2026
  222. Iteration statements - `for`, `foreach`, `do`, and `while` 01/16/2026
  223. Jump statements - `break`, `continue`, `return`, and `goto` 01/16/2026
  224. The lock statement - ensure exclusive access to a shared resource 01/16/2026
  225. Selection statements - `if`, `if-else`, and `switch` 01/16/2026
  226. using statement - ensure the correct use of disposable objects 01/16/2026
  227. yield statement - provide the next element 01/16/2026
  228. Code comments - `//` and `/*` - `*/` 01/14/2026
  229. Discard - A `_` acts as a placeholder for a variable 01/14/2026
  230. C# special characters 01/14/2026
  231. String interpolation using `$` 01/14/2026
  232. Raw string literal text - `"""` in string literals 01/30/2026
  233. Verbatim text - `@` in variables, attributes, and string literals 01/14/2026
  234. Unsafe code, pointer types, and function pointers 09/11/2026
  235. Example XML documentation comments 01/16/2026
  236. Generate XML API documentation comments 01/16/2026
  237. Recommended XML tags for C# documentation comments 09/10/2026
  238. Methods in C# 04/17/2025
  239. The updated .NET Core event pattern 03/11/2025
  240. Abstract and Sealed Classes and Class Members (C# Programming Guide) 07/20/2015
  241. Access modifiers (C# programming guide) 12/15/2025
  242. Anonymous types (C# Programming Guide) 04/10/2026
  243. Automatically implemented properties 11/18/2025
  244. Constants (C# Programming Guide) 07/20/2015
  245. Constructors (C# programming guide) 03/11/2025
  246. Extension members (C# Programming Guide) 11/20/2025
  247. Fields (C# Programming Guide) 05/25/2023
  248. Finalizers (C# Programming Guide) 08/20/2021
  249. How to create a new method for an enumeration (C# Programming Guide) 11/25/2025
  250. How to declare and use read write properties (C# Programming Guide) 07/29/2022
  251. How to define abstract properties (C# Programming Guide) 07/20/2015
  252. How to define constants in C# 07/20/2015
  253. How to implement a lightweight class with automatically implemented properties 07/29/2022
  254. How to implement and call a custom extension method (C# Programming Guide) 10/02/2024
  255. How to initialize a dictionary with a collection initializer (C# Programming Guide) 10/14/2025
  256. How to initialize objects by using an object initializer (C# Programming Guide) 12/20/2018
  257. How to override the ToString method (C# Programming Guide) 07/20/2015
  258. How to return subsets of element properties in a query (C# Programming Guide) 07/20/2015
  259. How to use implicitly typed local variables and arrays in a query expression (C# Programming Guide) 11/25/2025
  260. How to write a copy constructor (C# Programming Guide) 05/24/2023
  261. Implicitly typed local variables (C# Programming Guide) 07/20/2015
  262. Instance constructors (C# programming guide) 05/29/2024
  263. Interface Properties (C# Programming Guide) 08/20/2024
  264. Knowing When to Use Override and New Keywords (C# Programming Guide) 07/20/2015
  265. Local functions (C# Programming Guide) 11/22/2024
  266. Members (C# Programming Guide) 07/20/2015
  267. Methods (C# Programming Guide) 03/08/2021
  268. Named and Optional Arguments (C# Programming Guide) 10/10/2025
  269. Nested types (C# programming guide) 12/15/2025
  270. Object and collection initializers (C# programming guide) 02/04/2026
  271. Partial Classes and Members (C# Programming Guide) 11/18/2025
  272. Private Constructors (C# Programming Guide) 07/20/2015
  273. Properties (C# Programming Guide) 11/18/2025
  274. Restricting Accessor Accessibility (C# Programming Guide) 10/30/2024
  275. Static Classes and Static Class Members (C# Programming Guide) 10/13/2025
  276. Static Constructors (C# Programming Guide) 07/31/2024
  277. Use constructors (C# programming guide) 01/15/2025
  278. Using Properties (C# Programming Guide) 11/18/2025
  279. Versioning with the Override and New Keywords (C# Programming Guide) 07/20/2015
  280. Creating Variant Generic Interfaces 07/20/2015
  281. Covariance and Contravariance 07/20/2015
  282. Using Variance for Func and Action Generic Delegates 07/20/2015
  283. Using Variance in Delegates 07/20/2015
  284. Using Variance in Interfaces for Generic Collections 07/20/2015
  285. Variance in Delegates 07/20/2015
  286. Variance in Generic Interfaces 06/06/2019
  287. Programming concepts 10/10/2025
  288. Iterators 08/14/2018
  289. Delegates with Named vs. Anonymous Methods (C# Programming Guide) 12/20/2024
  290. How to combine delegates (Multicast Delegates) (C# Programming Guide) 03/05/2026
  291. How to declare, instantiate, and use a Delegate (C# Programming Guide) 12/20/2024
  292. Delegates (C# Programming Guide) 03/11/2025
  293. Using Delegates (C# Programming Guide) 12/20/2024
  294. How to implement custom event accessors (C# Programming Guide) 07/20/2015
  295. How to implement interface events (C# Programming Guide) 07/20/2015
  296. How to raise base class events in derived classes (C# Programming Guide) 07/20/2015
  297. How to subscribe to and unsubscribe from events (C# Programming Guide) 07/20/2015
  298. Events (C# Programming Guide) 03/11/2025
  299. Constraints on type parameters (C# Programming Guide) 11/25/2025
  300. Differences Between C++ Templates and C# Generics (C# Programming Guide) 07/20/2015
  301. Generic Classes (C# Programming Guide) 07/20/2015
  302. Generic Delegates (C# Programming Guide) 07/20/2015
  303. Generic Interfaces (C# Programming Guide) 11/18/2025
  304. Generic methods (C# programming guide) 07/20/2015
  305. Generic type parameters (C# Programming Guide) 07/20/2015
  306. Generics and Arrays (C# Programming Guide) 07/20/2015
  307. Generics in the runtime (C# programming guide) 07/20/2015
  308. Comparison Between Properties and Indexers (C# Programming Guide) 07/20/2015
  309. Indexers 08/20/2024
  310. Indexers in Interfaces (C# Programming Guide) 08/20/2024
  311. Using indexers (C# Programming Guide) 08/20/2024
  312. Explicit Interface Implementation (C# Programming Guide) 03/24/2021
  313. How to explicitly implement interface members (C# Programming Guide) 07/20/2015
  314. How to explicitly implement members of two interfaces (C# Programming Guide) 07/20/2015
  315. How to determine whether a string represents a numeric value (C# Programming Guide) 07/20/2015
  316. Strings and string literals 11/18/2025
  317. Boxing and Unboxing (C# Programming Guide) 10/13/2025
  318. Casting and type conversions (C# Programming Guide) 02/05/2025
  319. How to convert a byte array to an int (C# Programming Guide) 07/20/2015
  320. How to convert a string to a number (C# Programming Guide) 10/31/2024
  321. How to convert between hexadecimal strings and numeric types (C# Programming Guide) 07/20/2015
  322. Feature specifications 04/08/2026
  323. C# standard specification 08/19/2026
  324. Versioning in C# 09/17/2024
  325. Learn about any breaking changes in the C# compiler 03/21/2022
  326. What's new in C# 12 03/19/2024
  327. What's new in C# 13 11/18/2025
  328. What's new in C# 14 11/18/2025
  329. What's new in C# 15 09/11/2026
  330. The history of C# 11/18/2025
  331. Relationships between language features and library types 10/26/2023
  332. Tutorial: Explore C# closed hierarchies 07/03/2026
  333. Tutorial: Create compound assignment operators 11/14/2025
  334. Tutorial: Explore extension members in C# 14 and C# 15 07/15/2026
  335. Declare primary constructors for classes and structs 03/18/2025
  336. Tutorial: Explore C# union types 07/02/2026
  337. Version and update considerations for C# developers 06/26/2023