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.
Build an ASP.NET Core AI Assistant API with GitHub Copilot SDK in C#. Learn CopilotService as IHostedService, Channel-bridged SSE streaming, and AIFunctionFactory tools in a minimal API.
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 to control assembly scanning in Needlr, including filtering assemblies, controlling which types get discovered, and organizing type registration in .NET applications.
Learn how to use hosted services and background workers with Needlr, including automatic discovery of IHostedService and BackgroundService implementations.
Learn how to use keyed services in Needlr to register and resolve multiple implementations of the same interface using .NET 8's keyed service support.
Learn how to implement the decorator pattern in C# using Needlr's automatic decorator discovery, including the DecoratorFor attribute and manual decorator wiring.
Learn how to build modular .NET applications using Needlr's plugin system, including IServiceCollectionPlugin, IWebApplicationPlugin, and automatic plugin discovery.
Learn how to set up ASP.NET Core web applications with Needlr for dependency injection, including ForWebApplication, minimal APIs, and middleware configuration.
Deep dive into Needlr's Syringe class and its fluent API for configuring dependency injection, discovery strategies, and type registration in C#.
Learn how Needlr's automatic service discovery works in C# with convention-based registration, type scanning, and the DoNotAutoRegister attribute for .NET applications.
Compare Needlr's source generation and reflection strategies for dependency injection in C# to choose the right approach for AOT, performance, and flexibility.
Learn how to install and configure Needlr for dependency injection in .NET with step-by-step setup, NuGet packages, and your first fluent DI application.
Learn how Needlr simplifies dependency injection in C# with automatic service discovery, source generation, and a fluent API for .NET applications.
How can we use Dapper and strongly typed IDs from the StronglyTypedId package? Let's see if we can generalize the guidance from the original author!
How can you use an IServiceCollection in console applications to get dependency injection? Is this a viable option if you don't want to use Autofac?
Learn how to use Autofac ComponentRegistryBuilder in ASP.NET Core! We'll see how we can move closer to getting the C# plugin architecture support we want!
Learn how to use Autofac ContainerBuilder in ASP.NET Core to wire up dependency injection. I'll explore what we can and cannot do with this approach!
Learn how to use AutofacServiceProviderFactory in ASP.NET Core for dependency injection! This article explains how to set it up along with the pros and cons.
Learn how to use MudBlazor with Blazor interactive SSR! Blazor's Server Side Rendering can be used alongside MudBlazor for building your next Blazor app!
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.
Just how easy is it to make an API gateway in Zuplo? Zuper eazy. Check out how I'm making an ASCII art API with Zuplo as my API gateway!
Want to add API key authentication middleware into your ASP.NET Core application? Check out this article for a simple code example that shows you how!
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.
Curious about C# MongoDB insert benchmarks? In this article, I show you BenchmarkDotNet code and the results for several variations of inserting data!
Learn how to use C# Testcontainers for MongoDB! If you're developing a dotnet application and want to use MongoDB, Testcontainers can be a HUGE asset!
See code examples for how to delete documents from MongoDB in C#. This article covers the basics of different methods you can use to delete records from Mongo!
See code examples for how to update MongoDB documents in C#. This article covers the basics of different methods you can use to update records.
Learn the basics of MongoDB Filtering in C# with simple code examples! See how to use the MongoDB FilterDefinitionBuilder to support filtering in MongoDB.
This article explains the basics of inserting documents into MongoDB in C#. See code examples of InsertOne, InsertMany, and their async counterparts.
Running into issues with your Blazor render mode? In my case, I didn't even know it was breaking my dependency injection AND my event handlers. My error though!
See how you can use MudBlazor list items to make awesome GUIs! Properly leverage the MustList and MudListItem controls to get custom user interfaces!
Learn how to use Autofac in ASP NET Core applications with only a couple of lines of code! Avoid this common problem when setting up dependency injection.
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 use BenchmarkDotNet to effectively create and run benchmarks on your C# code. Dig into where you have opportunities to optimize your C# code!
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.
Learn how to use Polly in C# to handle faults and retries with ease! Check these 3 code examples showcasing different use cases of Polly in C#!
Learn how to use Scrutor in C# for dependency injection with these 3 simple tips. Try out Scrutor in your next C# application and simplify your registrations!
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!
Learn how to use Autofac in C# for dependency injection! Check out these three code examples to help you get started with dependency injection in C#.
Scrutor vs Autofac in C#! Which one comes out on top between these two solutions for dependency injection in dotnet? See how each are used with code examples!
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!
Step-by-step guide to using IServiceCollection in C# for dependency injection. Learn AddSingleton, AddScoped, and AddTransient with real code examples.
Use Testcontainers in ASP.NET Core testing to get better coverage! Learn how to simulate dependencies, test in parallel, and integrate with CI/CD tools!
Leverage NUNit in ASP.NET Core for crafting reliable code with confidence! Learn to create tests, use advanced techniques, and improve your code quality!
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!
Learn how to leverage xUnit in ASP.NET Core tests with simple code examples. See how to write easy-to-understand test code and cover your ASP.NET Core apps!
Learn about WebApplicationFactory in ASP.NET Core and leveraging it for testing. Use an HttpClient and implement the tips in this article for better tests!
Discover the benefits of middleware in ASP.NET Core, including flexibility and modularity. Learn about middleware like authentication and logging!
Learn about different types of middleware and how to implement custom middleware in ASP.NET Core to solve common challenges in web development!
Welcome to the Build a Blazor Web App Series! This is an exclusive Dev Leader Weekly article.
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!
What is Inversion of Control? Learn about Inversion of Control (IOC) and Dependency Injection and how it can be applied in real-world scenarios.
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!
Learn why test coverage can be misleading and the importance of balancing testing strategies to ensure maximum code quality and full bug detection.
We're done with excuses! No more claims that when dealing with legacy code your changes can't be tested! Check out this strategy to make anything more testable.
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!
Learn how to build an ASP.NET core web API! This tutorial for beginners will guide you through setting up the project to building the API endpoints.
Looking for an online C# compiler? DotNetFiddle is a convenient online C# compiler that's free to use. But what are all of the features of DotNetFiddle?
In this CSharp switch statement tutorial, you'll learn how to properly use switch statements in your programs. Explore examples, features, and best practices!
Unit test your Blazor project! Improve code quality and catch bugs early with improved test coverage. Check out this Blazor unit testing tutorial now!
Looking to enhance your C# coding skills? Learn how to use enums in Csharp with this beginner guide, including best practices, limitations, and examples.
Improve your Blazor unit testing! Look no further than this article on Blazor unit testing with bUnit. Get started from scratch and write useful tests!
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#!
In this article, you'll explore the importance of Blazor unit testing and learn about Blazor unit testing best practices. Get started with Blazor today!
Let's learn how to make a budgeting app in C#! We'll dive into ASP.NET Core Blazor, the basics of the app, and even VPS hosting options like RackNerd!
Wondering, "How can I write code on my phone"? Learn how to write code on your phone with DotNetFiddle! Perfect for beginner C# devs without a laptop/desktop!
Learn how to build a personal website in Blazor and ASP.NET Core to show case your skills and experiences. Get started with our ASP.NET Core tutorial today!
Learn how to call JavaScript from Blazor web assembly using JavaScript Interop in this guide! Perfect for developers learning more about Blazor web assembly!
See how to use DotNetFiddle, a leading online C# compiler. Develop, test, and share code! We'll answer what is DotNetFiddle in the world of online C# compilers.
Interested in unit testing in C#? Let's look at xUnit and Moq for unit testing! We'll explore mocking external dependencies and the role of these in unit tests.
Learn how to make a todo list in C# using ASP.NET Core and tackle data binding and user interface design. Blazor todo list - Perfect for a beginner portfolio!
You've started using Autofac for dependency injection in C#, but now you're wondering how to organize Autofac modules most effectively. Dive in for 5 easy tips!
In this article, we'll see how we can use an ASP.NET Core Blazor RenderFragment alongside plugins to dynamically load HTML into our applications!
Interested in building web applications? ASP.NET Core is a powerful dotnet tech stack for just that! Here are all of the details for ASP.NET Core for beginners!
If you want to get started with web development in dotnet core, check this out! We'll get you up and running in VS Code for ASP.NET Core web development!
If you want to get started with web development in dotnet core, check this out! We'll get you up and running in Visual Studio for ASP.NET Core web development!
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?
If you're looking to create and analyze dotnet benchmarks, you'll want to get started with BenchmarkDotNet. We'll explore benchmarking in C# to get you started!
If you're familiar with Autofac and module registration but want to make things easier, automatic module discovery might be for you! Let's see how it works!
Want to have a plugin architecture that supports dynamic loading for Blazor? Follow this tutorial for a Blazor plugin architecture that leverages Autofac!
Like building ASP.NET web applications and want to maximize extensibility? This guide is a how-to on using a plugin architecture in Blazor. Check it out!
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!
Want more flexible, extensible, and testable code? We'll use Autofac net core! What is Autofac? It's a powerful Dependency Injection framework in dotnet!
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.
Unit tests or functional tests? What's the difference and which ones should you be using? Find out in this super quick compare-and-contrast!
xUnit tests not running with .NET standard project settings? Here's a super quick solution to get you back up and running so you can test away!
Organizing code into Autofac modules can make maintaining code much easier and improve extensibility! It all starts with the Autofac module class. Check it out!
Looking to get started using dependency injection with Autofac in your projects? Here's a quick primer on what it is and how to get going for your next project.
An example in C# about how to create a singleton with support for dependency injection or inversion of control (IOC).