Tag
csharp
33 articles tagged with “csharp”
C# Generics Mastery: Constraints, Variance, and Generic Math in .NET 9
Type-safe abstractions without overhead — constraints, covariance/contravariance, INumber<T>, and the .NET 9 "allows ref struct" anti-constraint.
LINQ in .NET 9: Deferred Execution, IQueryable, and the New Operators
Practical LINQ for backend engineers — IEnumerable vs IQueryable, the .NET 9 CountBy/AggregateBy/Index additions, and EF Core translation pitfalls.
Async/Await in .NET 9: ConfigureAwaitOptions, Task.WhenEach, and Bounded Concurrency
Modern async patterns for ASP.NET Core — context capture, the .NET 8 ConfigureAwaitOptions enum, .NET 9 Task.WhenEach, and the anti-patterns that cause production incidents.
Dependency Injection in .NET 9: Lifetimes, Keyed Services, and the Scope Pattern
Lifetime selection, keyed services (.NET 8+), the BackgroundService scope pattern, and the four DI anti-patterns that cause production bugs.
EF Core 9 in Production: Tracking, Projections, and the Performance Levers That Matter
Bulk updates with ExecuteUpdateAsync, projection over Include, AsSplitQuery for cartesian explosion, auto-compiled models, and IDbContextFactory for parallel work.
The Repository Pattern in .NET: When It Helps, When It Hurts, and What to Use Instead
Why generic IRepository<T> over EF Core is usually an anti-pattern, when domain repositories earn their keep, and the specification pattern as a cleaner alternative.
CQRS in .NET Without the Cargo Cult: A Practical Guide for 2026
CQRS as a folder discipline, command/query handlers without MediatR, vertical slice architecture, and when eventual consistency is overkill.
Clean Architecture in .NET 9: One Rule, Four Layers, and When to Skip the Whole Thing
The dependency rule applied pragmatically — solution layout, port-and-adapter wiring, NetArchTest enforcement, and when Vertical Slice Architecture is the better fit.
Minimal APIs in .NET 9: Typed Results, Route Groups, and Endpoint Filters Done Right
Production-shaped Minimal APIs with typed Results<T>, route groups, endpoint filters, [FromKeyedServices], and the new built-in OpenAPI replacing Swashbuckle.
Binary Search: One Template That Solves Every Variant
Half-open [low, high) invariant, lower-bound and upper-bound, first/last occurrence, binary search on the answer, floating-point search, and the BCL helpers.
Sorting in 2026: Introsort, Stability, and When to Reach for Radix
.NET introsort vs LINQ stable OrderBy, comparator rules (never a - b), 0/1 vs unbounded knapsack-style iteration, counting sort, and external merge sort for data > RAM.
Recursion: When It's Elegant, When It's a Stack Overflow
Base/recursive/combine, memoization vs iteration, why .NET doesn't reliably tail-call optimize, and converting recursion to an explicit Stack<T> for adversarial depth.
Dynamic Programming: State, Recurrence, Base Case, Order
Top-down memoization vs bottom-up tables, coin change, 0/1 knapsack with reverse iteration, edit distance, LIS in O(n log n), and reconstructing the solution.
Trees: BSTs, Balance, and Why SortedDictionary Is Red-Black
BST vs self-balancing (red-black, AVL), B-trees in databases, heaps with PriorityQueue, tries for prefix queries, and iterative traversals that don't blow the stack.
Graph Traversal: BFS, DFS, Topological Sort, and the Visited Set
Adjacency list vs matrix, BFS for unweighted shortest path, DFS recursive vs iterative, Kahn's topological sort, three-colour cycle detection, and connected components.
Dijkstra in C#: PriorityQueue, A*, and Why Negative Edges Break It
Production Dijkstra with .NET PriorityQueue and the skip-stale pattern, path reconstruction, A* with admissible heuristics, multi-source variants, and Bellman-Ford for negatives.
PostgreSQL 17/18 in 2026: MVCC, Indexes, and EF Core 9
PG 17 (Sept 2024) async I/O, PG 18 (Sept 2025) features, MVCC + xmin/xmax, btree/GIN/GiST/BRIN, JSONB jsonb_path_ops, partial/functional indexes, EF Core 9 + Npgsql 9, EXPLAIN (ANALYZE, BUFFERS), VACUUM and PgBouncer pitfalls.
SQL Patterns: Joins, Window Functions, MERGE, and Killing N+1
N+1 to JOIN/LATERAL, EXISTS vs IN vs JOIN, ROW_NUMBER/RANK/SUM OVER, ANSI MERGE in PG 15+, ON CONFLICT upsert, Dapper parameterization, EXPLAIN read guide, NULL semantics + OR-defeats-index pitfalls.
Transactions and Isolation: ANSI Levels, MVCC, and SERIALIZABLE
Four ANSI levels, MVCC vs 2PL, EF Core 9 BeginTransactionAsync, [Timestamp] rowversion optimistic concurrency, FOR UPDATE SKIP LOCKED, write-skew, retry on 40001/40P01 with exponential backoff, transactional outbox over 2PC.
Redis 8 / Valkey in 2026: HybridCache, Streams, and Distributed Locks
Redis 8 SSPL/RSALv2 + Valkey LF fork, Azure Cache Enterprise, .NET 9 HybridCache (L1+L2 + stampede protection), atomic rate limit, SET NX EX + Lua compare-and-delete locks, Streams + consumer groups, sorted-set leaderboards, TTL jitter.
MongoDB 8.x: Embed vs Reference, ESR Indexes, and the Aggregation Pipeline
MongoDB 8.0 (Oct 2024) / 8.2, queryable encryption GA, Cosmos DB for MongoDB vCore + DocumentDB, MongoDB.Driver 3.x LINQ, embed-vs-reference rule, ESR compound indexes, partial/TTL indexes, aggregation pipeline, atomic positional updates.
Azure Cosmos DB: Partition Keys, RUs, and the Five Consistencies
Cosmos DB SQL API, 5 consistency levels, partition-key design (10GB cap, hot-partition avoidance), RU/s autoscale vs serverless, CosmosClient v3 Direct mode + DefaultAzureCredential, point reads (1 RU), change feed, hierarchical partition keys, vector search GA.
pgvector 0.8/0.9: HNSW, halfvec, and RAG on Postgres
pgvector 0.8 (Oct 2024) iterative scans + halfvec, 0.9 sparse vectors, HNSW vs IVFFlat, EF Core 9 + Pgvector.EntityFrameworkCore, halfvec/bit quantization, hybrid search with tsvector, maintenance_work_mem for builds.
Pinecone Serverless: Namespaces, Hybrid Search, and Reranking
Pinecone serverless GA (2024), namespaces for multitenancy, sparse-dense hybrid, .NET PineconeClient, batch upserts, metadata filtering, built-in rerankers (BGE/Cohere), tenant offboarding via DeleteAll.
Weaviate 1.27+: Multi-Tenancy, Dynamic Indexes, and Generative Search
Weaviate 1.27/1.28 multi-tenancy, dynamic indexes (flat → HNSW), text2vec/generative modules, gRPC v4 clients, hybrid alpha, generative-openai for RAG-in-one-call, tenant offboarding.
Normalization: 1NF to 3NF, Denormalize Reads, Snapshot Truths
1NF/2NF/3NF/BCNF in plain English, when to denormalize via materialized views or CQRS read models, snapshots vs duplication, REFRESH MATERIALIZED VIEW CONCURRENTLY, propagating changes via CDC.
REST Principles in 2026: Resources, Idempotency, and Problem Details
The five constraints that still matter (resources, methods, status codes, statelessness, cacheability), idempotency keys, RFC 9457 problem+json, cursor pagination over OFFSET, ETags + 304s, ASP.NET Core 9 MapGroup.
GraphQL with HotChocolate 14: Projections, DataLoaders, and Federation
When GraphQL beats REST and when it does not, HotChocolate 14 on .NET 9 with [UseProjection] + source-generated DataLoaders, persisted operations, cost analysis, Apollo Federation v2 with @key fields.
gRPC on .NET 9: HTTP/3, Streaming, Deadlines, and JSON Transcoding
Four call patterns (unary/server/client/bidi), .NET 9 server + strongly-typed client over HTTP/3, deadlines + ServiceConfig retry policies, gRPC-Web for browsers, JSON transcoding so one service speaks gRPC and REST.
WebSockets and SignalR: Heartbeats, Backplanes, and CSWSH Defense
WebSocket vs SignalR vs SSE vs WebTransport, .NET 9 SignalR Hub + MapHub, scale-out with Redis backplane or Azure SignalR Service, KeepAliveInterval heartbeats, JWT in query string, backpressure with Channels.
API Versioning: URL, Header, Media Type, and Sunset Discipline
Asp.Versioning 8 on .NET 9, URL/query/header/media-type schemes, additive evolution, one domain with multiple wire mappers, RFC 8594 Sunset + Deprecation headers, per-version OpenAPI documents.
Rate Limiting on .NET 9: Token Buckets, Redis, and Tiered Policies
Built-in RateLimiter middleware with FixedWindow/SlidingWindow/TokenBucket/Concurrency, partition by user/API key, distributed counters with Redis Lua INCR/EXPIRE, 429 + Retry-After + RateLimit-* headers, layered with APIM.
OpenAPI 3.1 on .NET 9: Built-in Spec, Scalar UI, and Kiota Clients
Microsoft.AspNetCore.OpenApi replacing Swashbuckle, OpenAPI 3.1 with JSON Schema 2020-12, Scalar / Redoc UIs, schema + document transformers, Kiota / NSwag SDK generation, Spectral lint + oasdiff in CI.

