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 73 of 77C# is vs as: Type Checking and Safe Casting
C# is vs as: Understand the differences between C#'s is and as operators for type checking and safe casting, including syntax, runtime behavior, and when to use each.
C# as Operator Usage: Syntax, Behavior, and Practical Examples
Learn how the C# `as` operator performs safe type conversion, when to prefer it over explicit casts, and why pattern matching is often a better choice in modern C#.
C# is Operator Usage: Type Checking and Pattern Matching
Learn how to use the C# is operator for type checking and pattern matching. This guide covers pattern forms, practical examples, and comparisons with as and explicit casts.
C# Convert vs Parse: When to Use Each
Compare C# Convert and Parse methods for type conversion, error handling, null behavior, and performance to choose the right approach.
C# Parse vs TryParse: When to Use Each
Compare C# Parse and TryParse for string-to-number conversion, covering exception behavior, performance, and when to use each.
C# TryParse Usage: Parsing Strings Without Exceptions
Learn how to use TryParse in C# to convert strings to numbers safely without exceptions, compare it with Parse, and avoid common culture and validation pitfalls.
C# Parse vs TryParse: When to Use Each for String Conversion
Learn how to use Parse and TryParse in C# for safe string conversion, including error handling, culture, and performance tradeoffs.
C# Double to Int Conversion: Casting and Rounding
Choose the right C# double-to-int conversion method. Direct casting truncates, Convert.ToInt32 rounds half-to-even, and Math methods give explicit control, including overflow handling.
C# int to double conversion: implicit conversion, casting, and Convert.ToDouble
Learn how to convert int to double in C# using implicit conversion, explicit casting, and Convert.ToDouble, and how to avoid the integer division pitfall.
C# String to Int Conversion: Parse vs TryParse vs Convert
Learn the practical differences between int.Parse, int.TryParse, and Convert.ToInt32 for C# string to int conversion, including error handling, null behavior, and culture.