Skip to main content

Posts

Showing posts with the label .NET source generators

Azure AI Search with C#: Build Smart Search (2026)

Learn Azure AI Search with C# — index data, run vector and hybrid queries, and add RAG to your .NET app. Start building intelligent search today. If your application's search box still runs a LIKE '%term%' query against SQL Server, your users are quietly suffering. They type "cheap laptop for uni" and get zero results because your catalogue says "affordable notebook for students." Azure AI Search with C# fixes exactly this problem: it combines classic keyword search, vector embeddings, and semantic reranking into a single managed service that you can drive from .NET with a few dozen lines of code. In this tutorial you'll build a working search index from scratch, run keyword, vector, and hybrid queries, and finish with a Retrieval Augmented Generation (RAG) pattern that grounds an LLM in your own data. This guide targets .NET 9 and the Azure.Search.Documents v11 SDK. Every snippet is runnable. We'll explain why each design choice matter...

C# Source Generators Tutorial: Automate Code at Compile Time

Learn C# source generators to automate code generation at compile time. Step-by-step tutorial with examples, best practices, and real-world use cases. What Are C# Source Generators? C# source generators let you inspect your code during compilation and automatically produce new C# files that become part of your project รข€” no manual coding, no runtime reflection, no post-build scripts. Introduced with .NET 5 and Roslyn, they run inside the compiler itself, giving you a compile-time hook to eliminate boilerplate at the source. If you have ever written the same property-changed notification, the same mapping method, or the same serialization logic across dozens of classes, source generators in C# solve that problem permanently. The compiler writes the code for you, every time you build. In this tutorial you will build a working source generator from scratch, understand the API surface, learn the patterns that scale, and avoid the mistakes that waste hours of debugging. Why Us...