Last updated: October 6, 2026
Every AI and machine learning article on this site for C# and .NET developers: calling large language models from C#, building agents and RAG chatbots, running models locally, training your own with ML.NET and TorchSharp, and AI tools for writing and reviewing C# code. Posts with a tested mark were rewritten from a working project; the others are tutorials that have not been re-run yet, so check package versions before you copy code.
Start here
| Your situation | Read this |
|---|---|
CS0246: The type or namespace name 'AnalyzeDocumentContent' could not be found after updating Azure.AI.DocumentIntelligence | Document Intelligence: the GA breaking changes |
An invoice total comes back null because the field is number, not currency | Document Intelligence: amounts gotcha |
| Choosing between GitHub Copilot, Claude Code, Codex, Cursor and JetBrains AI for C# | AI code generation tools compared |
| You want a chatbot over your own documents | RAG chatbot with Semantic Kernel |
| You want an LLM without sending data to a cloud API | Local AI with Ollama |
| You want to train a model on your own data in C# | ML.NET: your first model |
1. Call an LLM from C#
Start with the first one if you use OpenAI directly, the second if your company is on Azure.
- AI chatbot with the OpenAI .NET SDK: first chat completion, conversation memory, streaming, function calling, rate limits and token budgets.
- Azure OpenAI in C#: chat completions with Entra ID instead of keys, streaming, tool use, DI registration and Azure OpenAI vs OpenAI.
- Prompt engineering in C#: system vs user messages, few-shot prompts, structured JSON output, prompt injection and testing prompts like code.
- Fine-tune a model and call it from C#: fine-tuning vs RAG vs prompting, JSONL training data, starting the job from C# and Azure OpenAI fine-tuning.
2. Agents, RAG and search
- Semantic Kernel: build an AI agent: plugins as tools, chat history, the Agent Framework for multi-agent workflows and adding your own data.
- RAG chatbot with Semantic Kernel: chunking documents, ingesting into a vector store, retrieval and generation wired together.
- Vector databases: Qdrant, Pinecone, Weaviate: the same insert and search in all three, filtered queries, distance metrics and score thresholds.
- Azure AI Search: index model, uploading documents, full-text search with filters and facets, then vector and hybrid search.
- Generative AI architecture in .NET: Microsoft.Extensions.AI as the abstraction, RAG, tool calling, streaming, resilience and cost control.
3. Run models locally and process documents
- Local AI with Ollama: calling Ollama with HttpClient and OllamaSharp, streaming, ASP.NET Core integration and the OpenAI-compatible endpoint.
- Azure AI Document Intelligence: the SDK 1.0 GA breaking changes, invoice extraction with real output, confidence scores, long-running operations and free-tier limits. (rewritten; SDK run against Microsoft's sample responses, no live Azure calls)
4. Train your own models
ML.NET for classic machine learning inside a .NET app, TorchSharp when you need PyTorch-style deep learning.
- ML.NET: your first model: data models, pipeline, training, evaluation, saving the model, PredictionEnginePool and AutoML.
- ML.NET image classification: loading images from disk, training, honest evaluation and serving the model from ASP.NET Core.
- NLP with ML.NET: sentiment analysis, text featurization, multi-class classification and transformer-based text classification.
- Recommendation system with ML.NET: collaborative filtering with matrix factorization, top-N recommendations and what the metrics mean.
- TorchSharp deep learning: tensors, a first network, custom modules, mini-batch training, memory management and loading PyTorch models.
5. AI tools for writing C#
- Best AI code generation tools for C#: Copilot, Claude Code, Codex, Cursor, JetBrains AI and Kiro compared, with three generated samples run and the bugs found in them. (rewritten; samples run on .NET 10)
- GitHub Copilot in Visual Studio: setup, inline completions, Copilot Chat for refactoring and tests, and agent mode.
- GitHub Copilot tips for C#: steering with comments and signatures, custom instructions for a .NET repo, agent mode with tests as guardrails and the usual mistakes.
- AI code review in C#: a review bot that reads the diff, posts comments and runs in GitHub Actions, plus Roslyn for extra context.
Related guides
Hosting an AI feature behind an API? The ASP.NET Core tutorials guide covers rate limiting, health checks and background jobs. For the cloud services these posts call, see the cloud and security guide.
Comments
Post a Comment