What are GC generations and why does gen 2 hurt?
Simple meaning
Gen 0 is nursery for short-lived objects
Open the full page for Why, Steps, Example and Key takeaway.
Panel-ready .NET / C# questions for freshers and experienced developers. Practice at Coding Cadre in Faridabad, or Online from Delhi NCR.
Gen 0 is nursery for short-lived objects
Open the full page for Why, Steps, Example and Key takeaway.
Span is a stack-only view over contiguous memory so I can slice arrays and strings without extra allocations.
Open the full page for Why, Steps, Example and Key takeaway.
ConfigureAwait false skips capturing the SynchronizationContext, which avoids deadlocks in libraries that wait on Tasks.
Open the full page for Why, Steps, Example and Key takeaway.
I keep the context short-lived, batch SaveChanges, disable tracking for reads, and consider ExecuteUpdate for bulk.
Open the full page for Why, Steps, Example and Key takeaway.
Not in source or appsettings committed to git.
Open the full page for Why, Steps, Example and Key takeaway.
I start with traces and a profiler, not guesses.
Open the full page for Why, Steps, Example and Key takeaway.
GC reclaims managed objects no longer referenced.
Open the full page for Why, Steps, Example and Key takeaway.
The built-in container registers services with lifetimes: transient, scoped, singleton.
Open the full page for Why, Steps, Example and Key takeaway.
EF Core is an ORM that maps C# classes to tables and generates SQL.
Open the full page for Why, Steps, Example and Key takeaway.
You need GetAwaiter returning something with IsCompleted, OnCompleted, and GetResult.
Open the full page for Why, Steps, Example and Key takeaway.
ref struct types like Span can only live on the stack so they can safely point at stack memory.
Open the full page for Why, Steps, Example and Key takeaway.
I never block on .Result or .Wait in ASP.NET request threads.
Open the full page for Why, Steps, Example and Key takeaway.
Expand then contract: add nullable columns, dual-write, backfill, switch reads, drop later.
Open the full page for Why, Steps, Example and Key takeaway.
SaveChanges and command interceptors add auditing, multi-tenant filters, or soft-delete stamps.
Open the full page for Why, Steps, Example and Key takeaway.
Clients send an Idempotency-Key
Open the full page for Why, Steps, Example and Key takeaway.
Authenticate during the handshake, authorize per message when needed, and validate origin.
Open the full page for Why, Steps, Example and Key takeaway.
Sensitive actions re-check recent MFA or password confirmation.
Open the full page for Why, Steps, Example and Key takeaway.
Prefer System.Text.Json source generation, reuse buffers, and avoid ToList on huge graphs.
Open the full page for Why, Steps, Example and Key takeaway.
Domain has no infra references
Open the full page for Why, Steps, Example and Key takeaway.
I use a hosted service with the processor SDK, complete on success, and abandon or dead-letter on failure.
Open the full page for Why, Steps, Example and Key takeaway.