Pages

Topics

Tools

↑↓navigate↵openescclose

All syntax guides

Short, practical guides on programming syntax, language fundamentals, and the tools developers reach for every day.

3,965 guides across 14 topics

Topics

Latest guides

A magnifying glass over a C# class diagram highlighting method names, representing reflection retrieving methods at runtime.
C#

How to Get Methods with C# Reflection

Learn how to retrieve method metadata with C# reflection, use BindingFlags to filter results, resolve overloads, and cache MethodInfo for better performance.

ReflectionMethodInfoType InspectionRuntime Metadata
Diagram showing an interface bridging a generic method and multiple type instances, representing C# type class emulation.
C#

C# Type Class: Emulating with Interfaces

C# Type Class: Learn how to emulate type classes in C# using interfaces, generic constraints, and static generic classes, with tradeoffs and decision criteria.

C#Type ClassesInterfacesGeneric Constraints
A comparison diagram showing the C# typeof operator resolving a type at compile time and the GetType method discovering the runtime type of an object instance.
C#

C# typeof vs GetType: Compile-Time vs Runtime Type Resolution

The typeof operator resolves types at compile time, while GetType() discovers an object's runtime type. Includes code examples for inheritance, generics, interfaces, and null handling.

C#Type SystemReflectionRuntime Type
A magnifying glass inspecting a C# object to reveal its runtime Type, symbolizing reflection GetType.
C#

C# Reflection GetType: Inspect Runtime Types

Learn how to use C# reflection GetType to inspect runtime types, compare it with typeof, and avoid common pitfalls in real-world code.

C# ReflectionGetType MethodType ObjectRuntime Type Inspection
C# code snippet showing the typeof operator returning a Type object, with reflection metadata elements around it
C#

C# Reflection: typeof in Practice

Learn how to use C#'s typeof operator with reflection: getting Type metadata, inspecting members, handling generics and nullable types, and caching reflection results for performance.

reflectiontypeof operatorSystem.Typeruntime type inspection
C# caller line number attribute showing source code location in diagnostics
C#

C# CallerLineNumber: Usage and Examples

Learn how to use the C# CallerLineNumber attribute to capture the exact source line of method calls for logging, debugging, and diagnostics.

C#CallerInfoLoggingDiagnostics
A C# code editor showing a method with the CallerFilePath attribute and a log output highlighting the source file path.
C#

Getting the Caller File Path in C#

Learn how to use the CallerFilePath attribute in C# to capture the source file path of callers for logging, diagnostics, and debugging.

C#Caller InfoAttributesLogging
Diagram showing a method call with CallerMemberName attribute automatically passing the caller's name to an optional parameter.
C#

Using C# CallerMemberName to Avoid Hard-Coded Property Names

Learn to use the C# CallerMemberName attribute to capture caller names automatically, with practical examples for property change notifications and logging.

C#CallerMemberNameINotifyPropertyChangedAttributes
Illustration of the C# Obsolete attribute marking a deprecated class with a compiler warning seal
C#

The C# Obsolete Attribute: Marking Deprecated Code

Learn how the C# Obsolete attribute marks deprecated APIs, triggers compiler warnings or errors, and supports API migration.

C#Obsolete AttributeDeprecationCompiler Warnings
A visual representation of the C# Conditional attribute filtering method calls at compile time.
C#

C# Conditional Attribute: How It Works and When to Use It

c# conditional attribute: Learn how the C# Conditional attribute controls method call inclusion at compile time, with practical examples and limitations.

ConditionalAttributeDebugPreprocessorCompilation