C# Source Generators: Reading the Roslyn Syntax Tree
Master reading and traversing a Roslyn syntax tree in a C# source generator. Learn SyntaxTree, SemanticModel, and ForAttributeWithMetadataName for .NET 6+.
Master reading and traversing a Roslyn syntax tree in a C# source generator. Learn SyntaxTree, SemanticModel, and ForAttributeWithMetadataName for .NET 6+.
Learn the incremental source generator API in C# -- covers pipeline design, caching with IEquatable, performance tips, and best practices for modern .NET.
Learn how to create a C# source generator with .NET 10. Step-by-step guide covering project setup, IIncrementalGenerator implementation, and packaging.
Learn exactly how C# source generators work inside the Roslyn compilation pipeline. Understand the two-phase compilation model, syntax providers, and incremental execution.
Understand what C# source generators are, their history in .NET, and how they differ from reflection and T4 templates. A clear introduction for .NET developers.
Master C# source generators with this complete guide. Learn how compile-time code generation works in .NET 10, why it beats reflection, and how to get started.
Learn how exception handling works in C# with the basics of try catch. This article is perfect for junior software engineers aiming to understand dotnet and C#.
Learn how to convert a C# string to a byte[] using UTF-8, ASCII, and Unicode encodings. Copy-paste code examples included for each method.
I tried to get C# regular expression benchmarks in my original article, but messed up a critical assumption. Let's see how to fix that and get the real data!
Regular expressions are powerful for pattern matching, but what about performance? Check out this article for details on C# regex performance from benchmarks!
Check out these 3 simple examples of regular expressions in C#! If you're new to regex and coding in CSharp, these are a perfect starting point for you!
Regular expressions are powerful for pattern matching, but what are the regex options in C# that we have access to? What do they do and how can we use them?
Check out these benchmarks measuring collection initializer performance in C#. How the heck did I speed up C# collection initialization by 87%?!
See code examples for C# collection initializers and collection expressions! Compare and contrast the readability of these different examples.
Using reflection in DotNet to create object instances? See the performance of ConstructorInfo compared to other methods provided by reflection in DotNet!
Let's compare Activator.CreateInstance vs Type.InvokeMember! Check out this head to head battle for ways to create instances using reflection in dotnet!
Learn how to safely use async event handlers in C#. Understand the dangers and discover best practices for managing async event handlers in your C# code.
Learn how to automatically cast between types in C#! Leveraging implicit operators in C#, we can do away with explicit casts to convert between types.
Learn why async void methods in C# can be dangerous with clear code examples. A perfect for beginner software engineers wanting to understand the risks.
Learn how to perform implicit conversions by using implicit operators in C#. This is a helpful feature that can enhance readability when done with care.
Leverage Activator.CreateInstance in C#, part of reflection in C#, to create object instances! This beginner's guide walks you through simple C# code examples.
Dive into async await in C# with these 3 beginner tips. Learn how to write async await code, handle multiple exceptions, and avoid dreaded deadlocks!
Reflection in C# is powerful, but with great power comes great responsibility. Check out these 4 quick examples of reflection in C# to see it in action!
Considering C# as you get started on your programming journey? This article is focused on C# for beginners, and I've included 5 concepts from C# with code!
Are you struggling with memory leaks due to your event handlers and events in C#? Check out how weak events in C# can help with garbage collection in your apps!
What does yield do in C#? Explore the benefits of using C# yield keyword with large datasets and best practices for implementation. One more tool to leverage!
Explore foreach loops in C# and how they simplify iterating through collections and arrays. Learn the basics of foreach loops and how to avoid common mistakes.
Learn how to format a string as Base64 in CSharp, including examples of encoding and decoding strings. Improve your coding skills with these practical tips!
Wondering how to compare strings in CSharp? We'll compare using string.Equals(), string.Compare(), and == operator to weigh the pros and the cons.
This is an exclusive article for Dev Leader Weekly readers! Check out some API design considerations when moving to a paging API from iterators!
What is string interpolation in C#? Learn about its definition, syntax, and benefits for improving code readability and efficiency. Check out this guide!
Learn how to make your code more readable, flexible, and maintainable with CSharp optional parameters. Check out these examples of optional parameters in C#!
Discover how to master the CSharp switch statement to make your code more effective and efficient. Follow along with C# switch statement examples!
Discover the benefits of using enums in CSharp, how to declare them step-by-step with examples, and the different types of enums available in this article!
In this CSharp switch statement tutorial, you'll learn how to properly use switch statements in your programs. Explore examples, features, and best practices!
Looking to enhance your C# coding skills? Learn how to use enums in Csharp with this beginner guide, including best practices, limitations, and examples.
Learn about reflection in CSharp and how it can be used. See how reflection in C# allows you to explore and modify objects, classes, and assemblies at runtime.
Learn about exceptions in CSharp and effective exception handling. We'll cover try-catch blocks and other tips for working with exceptions in C#!
If you're a programmer dealing with converting bytes to and from strings, you'll deal with character encodings. But in the ASCII vs UTF8 debate, who wins?
After some of the basics of dictionaries in C#, what else do dictionaries in dotnet have to offer us? Let's dive in before we get into the performance deep end!
Dictionaries in C# are heavily used by all levels of software developers. Let's look at some dictionary use cases and comparisons to other collections in C#!
In this article, we'll dive into a dictionary in C#! There are many collections for us to use in dotnet, and the dictionary class is one that is invaluable!
In C#, how can we balance asynchrony and laziness? Is there such a thing as async lazy? Let's explore our options built into dotnet!
Implicit operators in C# are a feature that can make our code more readable and expressive. But beware! Misuse can backfire and cause a great deal of headaches!
Exceptions and exception handling are a core part of C# and many other programming languages. But what If we didn't need to be throwing them?
Want to see how implicit operators work in C#? Check out this example code to see how you can make a multi-type object in dotnet that uses implicit operators!
I wanted to create a follow-up post in my series on IEnumerables, iterators, and collections focusing on performance characteristics. When checking out the runtime performance and memory characteristics between these materialized collections and iterator benchmarks, I was very surprised! Check out this article for performance benchmark characteristics and some curious finds.
If you're writing asynchronous code in C# and using EventHandlers, odds are you've had issues with exceptions. Task EventHandlers might be consideration!
Dealing with async EventHandlers in C# can be very problematic. async void is a pattern cause headaches with exceptions. Check out this simple solution!
New to C# and looking to understand more about the IEnumerable interface? Check out this article for a crash course on getting started with C# IEnumerable!
Most intermediate dotnet devs writing async await code in C# will come across async void at some point. Here's a creative solution for avoiding the headaches.