Unlock Cleaner Code With C#'s Action And Func Delegates
In C#, Action and Func allow treating behavior as data. Use them for cleaner, more flexible code. Examples include Strategy Pattern using Func and Command Pattern using Action.
Tech Lead | Senior Software Engineer | .NET Enthusiast (BSc, MSc, MCP, MCSD) Contact Information: GitHub Portfolio: https://github.com/stevsharp Dev.to Contributions: https://dev.to/stevsharp
In C#, Action and Func allow treating behavior as data. Use them for cleaner, more flexible code. Examples include Strategy Pattern using Func and Command Pattern using Action.
Learn how to simplify CQRS with MediatR in ASP.NET Core Minimal API. Decouple request handling logic, improve performance & scalability, and separate concerns for better maintainability.
Creating an Identity Service for JWT authentication in Minimal APIs, encapsulating token generation logic within a service for modularity and testability.
ValueTask is a .NET structure for micro-optimizations in async programming, offering better performance than Task in specific use cases like synchronous results or high-performance scenarios.
Table hints in SQL Server control query interaction with data, locks & optimizer. Learn basics, use cases & pitfalls for NOLOCK, UPDLOCK, HOLDLOCK, ROWLOCK & TABLOCK hints. Use sparingly, test thoroughly & monitor deadlocks.
The Mediator Pattern reduces dependencies between objects by centralizing communication through a mediator interface & concrete implementation, promoting loose coupling & maintainability in complex systems.
The State Pattern lets objects change behavior dynamically based on their internal state, making it ideal for handling complex, state-dependent behavior in a maintainable way.
The Strategy Pattern enables runtime selection of algorithms from a family of algorithms, promoting flexibility & modularity in software design. It encapsulates behavior, adheres to the Open/Closed Principle & reduces code duplication.
State Pattern: Behavioral design pattern that changes object behavior based on internal state, eliminating complex conditional logic & improving code organization & maintainability. Used in workflow systems, game dev & UI components.
Simple Blazor Grid: feature-rich grid component for Blazor Server & WebAssembly. Supports sorting, filtering, pagination, customizable headers & rows. Open-source on GitHub @ https://github.com/stevsharp/SimpleBlazorGrid
C# 9.0 introduces records, a new type that simplifies immutable object creation with nondestructive mutation and value-based equality. Ideal for DTOs, configuration models & functional programming.