Chapter 1 — The .NET Developer’s AI Landscape
- 1.1 Let’s Get the Elephant Out of the Room
- 1.2 What Is a Large Language Model, Actually?
- 1.3 Base LLMs vs Instruction-Tuned LLMs
- 1.4 The Cost Spectrum: Local → Cloud → Enterprise
- 1.5 The Microsoft AI Stack for .NET Developers
- 1.6 Why C# Is Great for AI Application Development
- 1.7 What Prompt Engineering Actually Is
- 1.8 A Note on Hallucinations (and Why You Should Care)
- 1.9 What This Book Covers (and What It Doesn’t)
- 1.10 Sneak Peek: What Your Code Will Look Like
- 1.11 Chapter Summary
Chapter 2 — Setting Up Your AI Development Environment
- 2.1 What We’re Building
- 2.2 Path A: Local with LM Studio (Free)
- 2.3 Path B: OpenAI API
- 2.4 Path C: Azure AI Foundry
- 2.5 Setting Up the .NET Project
- 2.6 The Provider-Switching Pattern
- 2.7 Running HelloAI
- 2.8 Practical: HelloAI — Your First LLM Call
- Chapter Summary
Chapter 3 — How LLMs Work (Just Enough Theory)
- 3.1 Why This Chapter Exists (and What It Deliberately Skips)
- 3.2 Tokens: The Currency of LLMs
- 3.3 The Context Window: Your Model’s Working Memory
- 3.4 Temperature and Sampling: Controlling Randomness
- 3.5 The Chat Message Structure
- 3.6 Other Parameters Worth Knowing
- 3.7 Why the Same Prompt Gives Different Results
- 3.8 Practical: Parameter Playground
- Chapter Summary
Chapter 4 — Anatomy of a Great Prompt
- 4.1 From Good Intentions to Reliable Outputs
- 4.2 The 5-Part Prompt Anatomy
- 4.3 The Two Foundational Principles
- 4.4 Prompt Templates in C#: From String Interpolation to PromptBuilder
- 4.5 The Iterative Prompt Loop
- 4.6 Practical: PromptBuilder — Your Code Review Assistant
- 4.7 Chapter Summary
Chapter 5 — Core Prompting Techniques
- 5.1 Zero-Shot Prompting — When a Single Instruction Is Enough
- 5.2 Few-Shot Prompting — Teaching by Example
- 5.3 Role Prompting — Persona Engineering for Specialist Output
- 5.4 Chain-of-Thought — From “Step-by-Step” to “Think Hard”
- 5.5 Self-Consistency — Majority Rules
- 5.6 Sycophancy — The Problem You Didn’t Know You Had
- 5.7 Rubric-Based Prompting — Forcing Objectivity
- 5.8 Constraint Prompting — Setting Limits
- 5.9 Brainstorming Patterns — Getting Options, Not Oracles
- 5.10 Practical: TechniqueBenchmark
- Chapter Summary
Chapter 6 — Structured Outputs and Advanced Patterns
- 6.1 The Output Problem
- 6.2 Structured JSON Output — From Text to Types
- 6.3 Defensive Parsing — When the Model Doesn’t Follow Instructions
- 6.4 Streaming — Output as It Arrives
- 6.5 Resilience Patterns — Building on Fundamentally Unreliable Components
- 6.6 The Model-as-Validator Pattern — Generate, Validate, Correct
- 6.7 Prompt Injection in Production — When User Content Is Hostile
- 6.8 Practical — DocumentSummaryService
- Chapter Summary
Chapter 7 — Prompt Patterns for Real Developer Workflows
- 7.1 Code Review — Actionable, Not Chatty
- 7.2 Unit Test Generation — From Signature to Test Suite
- 7.3 Commit Messages and PR Descriptions — From Diff to Words
- 7.4 Documentation Generation — XML Docs and README Sections
- 7.5 Practical: DevToolkit — One App, Four Workflows
- 7.6 What Comes Next
- Chapter Summary