Browse by Topic

Popular

Latest

Latest C# Posts

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
Illustration of a C# code block with a custom attribute label and reflection arrows showing runtime metadata lookup
C#

How to Use C# Custom Attribute Classes

Learn how to define, apply, and read C# custom attribute classes, including AttributeUsage constraints and reflection-based retrieval.

C# attributesreflectionmetadatacode annotations
Illustration showing a C# attribute declaration on a code element with reflection retrieving metadata.
C#

C# Attribute Declaration Syntax and Usage

Learn the exact syntax for C# attribute declaration, including constructors, properties, targets, and retrieval via reflection.

C# attributesAttributeUsageCustom attributes.NET reflection
Diagram showing C# code elements tagged with metadata labels, illustrating how attributes attach to declarations.
C#

C# Attributes: Syntax, Usage, and Runtime Behavior

Learn the syntax, targets, and runtime behavior of C# attributes, including custom attributes, reflection, and practical validation examples.

C# AttributesReflectionCustom AttributesMetadata
C# params keyword illustrating multiple arguments being passed into a method
C#

C# Params Multiple Arguments

Learn how the C# params keyword lets methods accept multiple arguments without explicit arrays, including syntax, overload resolution, null handling, allocation tradeoffs, and when to use collections instead.

params keywordmethod overloadingargument passingC# syntax