C# guides
Every published C# guide, newest first, with practical examples you can copy into your own project.
3,965 guides across 14 topics
Topics
Popular C# guides
Most readLatest C# guides
Page 38 of 77C# try catch: Syntax, Usage, and Pitfalls
c# try catch: Learn the practical syntax and behavior of the C# try-catch statement, including exception filters, finally, performance implications, and common mistakes.
C# Exception Handling: Patterns for Robust Code
Practical C# exception handling patterns: try-catch-finally, exception filters, custom exceptions, performance tradeoffs, async code, and result types.
C# Generic In vs Out: Covariance and Contravariance
Understand C# generics `in` vs `out`: covariance and contravariance, when to use each keyword, and how the compiler enforces these rules.
C# Generic Contravariance: How It Works
Learn how C# generic contravariance lets base-type implementations work with derived types, including practical interface and delegate examples.
C# Generic Covariance: How It Works and Where to Use It
Understand C# generic covariance with practical examples, including how the out keyword enables safe type substitution in interfaces and delegates.
C# Multiple Generic Type Parameters: Syntax and Usage
c# multiple generic type parameters: Learn how to declare and use C# generic types and methods with multiple type parameters, including constraints, type inference, an...
C# where T : unmanaged: Generic Unmanaged Types
Learn how the C# where T : unmanaged constraint enables generic code with pointers, stackalloc, and sizeof, and when to use it.
C# where T notnull: Generic Constraint Explained
c# where t notnull: Understand the C# notnull generic constraint, how it works with nullable reference types, and when to apply it in your generic APIs.
C# where T : new() Constraint: Syntax and Usage
c# where t new: Understand the C# where T : new() constraint: how it requires a parameterless constructor, where it applies, and how to use it safely in generic code.
C# where T : struct: Generic Value Type Constraints
The C# `where T : struct` constraint restricts generic parameters to non-nullable value types. See how it changes `T?` to `Nullable<T>`, when to use it, and where boxing can still happen.