Best of C#July 2025

  1. 1
    Article
    Avatar of csharpcornerC# Corner·47w

    Polymorphic deserialization in .NET 8.0

    .NET 8 introduces built-in support for polymorphic JSON serialization and deserialization through JsonPolymorphic and JsonDerivedType attributes. This eliminates the need for workarounds when handling inheritance hierarchies in JSON processing. The feature uses a discriminator field to identify the correct derived type during deserialization, making it easier to work with polymorphic objects in APIs, message processing, and document storage scenarios.

  2. 2
    Article
    Avatar of devblogsDevBlogs·47w

    Local AI + .NET = AltText Magic in One C# Script

    A practical guide showing how to generate image alt text using .NET 10's new script execution feature and local AI models via Ollama. The tutorial demonstrates creating a complete solution in a single C# file that can analyze images and produce accessibility-friendly descriptions without cloud dependencies or rate limits.

  3. 3
    Article
    Avatar of milanjovanovicMilan Jovanović·45w

    Global Error Handling in ASP.NET Core: From Middleware to Modern Handlers

    Explores three approaches to global error handling in ASP.NET Core: traditional middleware, IProblemDetailsService for standardized responses, and the modern IExceptionHandler introduced in .NET 8. The article demonstrates how to implement each approach with code examples, showing the evolution from simple try-catch middleware to chainable, focused exception handlers. It covers practical scenarios like validation error handling with FluentValidation and emphasizes the benefits of the newer IExceptionHandler approach for maintainability and testability.

  4. 4
    Article
    Avatar of telerikTelerik·45w

    Understanding Parallel Programming in ASP.NET Core

    Explores five native ASP.NET Core features for implementing parallel programming to improve application performance and scalability. Covers Parallel.ForEach, Parallel.Invoke, Task.WhenAll/WhenAny, Task.Run, and Parallel.ForEachAsync with practical examples. Explains the difference between parallelism and asynchrony, demonstrating how to combine both approaches for CPU-bound and I/O-bound operations. Includes performance comparisons showing significant time reductions when using parallel execution over sequential processing.

  5. 5
    Article
    Avatar of csharpcornerC# Corner·43w

    Mastering Dependency Injection in .NET Core: A Complete Beginner-to-Advanced Guide

    Dependency Injection (DI) is a design pattern that promotes loose coupling, testability, and maintainability in .NET Core applications. The guide covers service registration in Program.cs, constructor injection, three service lifetimes (Transient, Scoped, Singleton), testing with mocked services, and advanced scenarios including factory-based registration and third-party containers like Autofac. Best practices include preferring interfaces over concrete classes, avoiding service locator patterns, and organizing registrations by feature modules.

  6. 6
    Article
    Avatar of c0de517ec0de517e's weblore·44w

    ImagePeeker.

    ImagePeeker is a debugging tool that continuously monitors process memory and displays it as 2D images. The tool supports multiple pixel formats including HDR, can handle block-swizzled images, and enables visual debugging of graphics applications. The author advocates for creating simple, custom debugging tools to enhance development workflow, particularly for C/C++ programmers who lack advanced visual debugging capabilities in traditional debuggers.

  7. 7
    Article
    Avatar of dotnet.NET Blog·44w

    Choosing the Right Copilot Experience for .NET

    GitHub Copilot Chat offers two distinct modes for .NET developers: Ask Mode for quick conversational support and code examples without workspace interaction, and Agent Mode for intelligent codebase analysis and direct file modifications. Ask Mode excels at explaining concepts, providing code snippets, and answering general questions, while Agent Mode handles refactoring, test generation, bug fixes, and automated tasks within your actual project files. The choice depends on whether you need conceptual guidance or hands-on code manipulation.

  8. 8
    Article
    Avatar of andrewlock.NET Escapades·45w

    C# 14 extension members; AKA extension everything

    C# 14 introduces extension members, expanding beyond traditional extension methods to support static extension methods, static and instance extension properties, and extension operators. The new syntax uses extension blocks with receiver parameters, allowing developers to add static methods directly to types and create extension properties. While the syntax requires more nesting and may appear unfamiliar, it provides better alignment between how extensions are defined and used, with all existing extension methods remaining compatible.

  9. 9
    Article
    Avatar of csharpcornerC# Corner·44w

    Integrating React with ASP.NET Core 8 in Visual Studio 2022

    Learn how to build a full-stack application by integrating React frontend with ASP.NET Core 8 Web API backend using Visual Studio 2022. The guide covers setting up both projects, configuring CORS for cross-origin requests, using Vite for React development, and establishing communication between frontend and backend through RESTful endpoints. Includes practical examples with a todo controller and demonstrates running both applications simultaneously in Visual Studio's integrated development environment.

  10. 10
    Article
    Avatar of andrewlock.NET Escapades·46w

    Behind the scenes of dotnet run app.cs

    .NET 10 introduces the ability to run single C# files without a .csproj using `dotnet run app.cs`. Behind the scenes, the SDK creates a virtual project file in memory by parsing #: directives for packages, properties, and SDKs, then uses MSBuild to restore and build the application. The implementation includes caching mechanisms to avoid unnecessary rebuilds and handles various edge cases through target overrides to work around NuGet limitations with in-memory projects.