All syntax guides
Short, practical guides on programming syntax, language fundamentals, and the tools developers reach for every day.
3,980 guides across 14 topics
Topics
Popular guides
Most readLatest guides
Page 323 of 398C# const vs readonly vs static readonly: What to Use When
C# const vs readonly vs static readonly: Learn the differences between these modifiers, including initialization timing, memory behavior, and when each is the right choice.
C# Class vs Struct vs Record: Choosing the Right Type
Choose the right C# type by learning how class, struct, and record differ in reference vs value semantics, equality, performance, and common use cases.
C# Switch Statement vs Switch Expression: Which to Use?
Compare the classic C# switch statement with the switch expression: syntax, pattern matching, exhaustiveness, and when each form fits best.
C# Collection Expression vs Collection Initializer
Compare C# collection expressions and collection initializers: syntax, type inference, span support, and when to use each.
C# Collection Initializer vs Object Initializer
c# collection initializer vs object initializer: Understand the difference between C# collection initializers and object initializers, how the compiler translates each...
C# InterceptsLocation Attribute Usage
Learn how to use C# InterceptsLocationAttribute with source generators to redirect method calls at compile time, including syntax, limitations, and debugging tips.
Implementing C# Interceptors with a Minimal Example
C# interceptors let a method replace calls at specific source locations during compilation. This article shows a minimal source generator, how the compiler resolves intercepted calls, and when the preview feature is practical.
C# Lambda Explicit Return Type
c# lambda explicit return type: Learn when and how to specify an explicit return type for a C# lambda expression, including syntax, limitations, and practical examples.
C# Lambda Ref Parameter: Why It's Not Allowed
c# lambda ref parameter: Learn why C# lambda expressions cannot declare ref parameters and how to use local functions or wrapper types to achieve pass-by-reference beh...
C# Lambda Params: Syntax and Common Pitfalls
Learn how to define lambda parameters in C#, including implicit and explicit types, multiple parameters, and working with params arrays through delegates.