Skip to main content

Posts

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# Primary Constructors: Simplify Classes (C# 12 Guide)

Learn C# primary constructors with runnable examples, best practices and pitfalls. Cut boilerplate in C# 12 classes and DI services — start coding today. If you have ever written a service class in .NET and felt like you were typing the same parameter name three times — once in the constructor signature, once in the assignment, once in the field declaration — then the C# primary constructor is the feature you have been waiting for. Introduced in C# 12 (shipped with .NET 8 in November 2023), primary constructors let you declare constructor parameters directly on the class or struct declaration and use them anywhere in the body. This tutorial covers the syntax, the semantics that trip people up, real-world dependency injection patterns, and the pitfalls that static analysis will not always catch. What Is a C# Primary Constructor? A primary constructor is a parameter list attached directly to a type declaration. Those parameters are in scope for the entire class body — field init...

AI Agents in C#: Build Autonomous Agents with Semantic Kernel

Learn how to build AI agents in C# with Semantic Kernel. Step-by-step .NET tutorial with runnable code, plugins, tool calling and best practices. Start building today. Building AI agents in C# used to mean gluing together HTTP calls, JSON schemas and a lot of hopeful string parsing. That era is over. With Microsoft Semantic Kernel , .NET developers now have a first-class agent framework that handles tool calling, memory, planning and multi-agent collaboration — all with strongly typed C# code, dependency injection and the async patterns you already know. In this tutorial you'll learn how to build autonomous, task-solving AI agents in C# from scratch, understand why each piece exists, and avoid the pitfalls that burn most teams on their first production deployment. What Is an AI Agent (and How Is It Different From a Chatbot)? A chatbot answers. An agent acts . The practical difference comes down to one loop: Goal — the agent receives a task, not just a message (...

Git Best Practices for .NET Teams: Branching & PRs

Learn Git best practices for .NET teams — branching strategies, clean commits, and pull request reviews that scale. Start shipping safer C# code today. Most .NET teams don't lose time to hard algorithms. They lose it to a 4,000-line pull request nobody wants to review, a develop branch that hasn't been merged in three weeks, and a merge conflict in a .csproj file that silently drops a package reference. Adopting solid git best practices fixes more delivery problems than any refactor, because it changes how your team integrates work rather than how one developer writes it. This guide covers the Git workflow decisions that matter specifically for C# and .NET teams: which branching strategy to pick, how to write commits that survive a production incident, how to keep pull requests reviewable, and the .NET-specific pitfalls (solution files, generated code, secrets in appsettings.json ) that generic Git tutorials never mention. Why Git Best Practices Matter More in .NET C...

Build an AI Recommendation System in C# with ML.NET

Learn how to build an AI recommendation system in C# using ML.NET collaborative filtering and matrix factorization. Full code, best practices — start today. Every product team eventually gets the same request: "Can we show users what they'll probably like next?" If your stack is .NET, you don't need Python, a separate microservice, or a data science team to answer that. You can build a production-grade recommendation system in C# using ML.NET's matrix factorization trainer — the same collaborative filtering technique that powers the "because you watched…" rails on major streaming platforms. This tutorial walks through the full pipeline: loading rating data, training a model, evaluating it honestly, generating top-N recommendations, and shipping it inside an ASP.NET Core API. What Collaborative Filtering Actually Does Collaborative filtering makes a deceptively simple bet: people who agreed in the past will agree in the future . It ignores what a...

GitHub Actions CI/CD for .NET: Build, Test & Deploy Guide

Learn GitHub Actions CI/CD for .NET with a complete YAML workflow to build, test and deploy your app to Azure. Copy the pipeline and ship today. If you are still clicking "Publish" from Visual Studio to get your API into production, you are one tired Friday away from an outage. GitHub Actions .NET pipelines solve that problem: every push builds your solution, runs your tests, and — when the tests pass — ships the artifact to Azure, AWS, or your own server, without a human touching a button. In this tutorial you will build a complete GitHub Actions CI/CD workflow for a .NET 10 application from an empty YAML file to a production deployment with environment approvals, and you will understand why each block exists rather than just copying it. Everything below is runnable. You will need a GitHub repository, a .NET solution with at least one test project, and (for the deployment half) an Azure App Service or any host that accepts a zip deploy. Why GitHub Actions for a .NET ...

C# Span Tutorial: Zero-Allocation Performance Guide

Tutorial: Zero-Allocation Performance Guide" style="width:100%;max-width:800px;border-radius:8px;margin-bottom:20px;" /> Learn C# Span and Memory with runnable examples, benchmarks, and best practices. Start writing zero-allocation, high-performance .NET code today. If you have ever profiled a hot code path in .NET and watched the garbage collector eat 30% of your CPU time, you already understand why C# Span<T> exists. Introduced in .NET Core 2.1 and now central to the entire BCL, Span<T> and its heap-friendly sibling Memory<T> let you slice, parse, and transform contiguous memory without allocating a single byte . This tutorial covers how both types work, when to use each, runnable benchmarks that prove the gains, and the pitfalls that trip up even senior developers. Why C# Span<T> Matters for Performance Optimization Most everyday C# code allocates far more than developers realise. Calling Substring , Split , ToArray , or Skip()...

How to Hash Passwords in C#: PBKDF2 & bcrypt Guide

Learn password hashing in C# the right way: salting, PBKDF2, bcrypt, and ASP.NET Core Identity, with runnable .NET code and best practices. Read the guide now. If your app stores user passwords, how you store them can decide whether a database breach is a small problem or front-page news. Password hashing in C# is one of the most important security skills a .NET developer can have, and it's also one of the most often done wrong. This guide explains what hashing and salting actually do, why plain SHA-256 isn't good enough, and how to use PBKDF2 , bcrypt , and ASP.NET Core Identity's PasswordHasher correctly. Every example is runnable code for modern .NET (8, 9, and 10). Whether you're a beginner looking up "how to hash a password in C#" or a senior engineer checking your team's approach against current OWASP guidance, you'll find practical, production-ready answers here. Why You Should Never Store Plain-Text or Encrypted Passwords Start with...