What is a delegate and how do events use it?
Simple meaning
A delegate is a type-safe function pointer.
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.
A delegate is a type-safe function pointer.
Open the full page for Why, Steps, Example and Key takeaway.
Generics keep type safety and avoid boxing of value types.
Open the full page for Why, Steps, Example and Key takeaway.
Transient is a new instance every resolve.
Open the full page for Why, Steps, Example and Key takeaway.
The context snapshots entity instances and generates INSERT, UPDATE, or DELETE on SaveChanges.
Open the full page for Why, Steps, Example and Key takeaway.
I Include the navigation I need, or project to an anonymous type or DTO in one Select.
Open the full page for Why, Steps, Example and Key takeaway.
Ref passes a variable that must already be assigned and can be read and written.
Open the full page for Why, Steps, Example and Key takeaway.
Records are reference types with value-based equality and a concise init syntax.
Open the full page for Why, Steps, Example and Key takeaway.
Exceptions are for unexpected failures
Open the full page for Why, Steps, Example and Key takeaway.
The pool reuses worker threads for Tasks and I/O completions.
Open the full page for Why, Steps, Example and Key takeaway.
The GC frees unreachable objects, but event handlers, static caches, and forgotten subscriptions keep objects reachable.
Open the full page for Why, Steps, Example and Key takeaway.
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.
Classes are reference types on the heap
Open the full page for Why, Steps, Example and Key takeaway.
Properties expose get and set accessors like fields but with control.
Open the full page for Why, Steps, Example and Key takeaway.
Async await frees threads while waiting on I/O without blocking.
Open the full page for Why, Steps, Example and Key takeaway.
The Common Language Runtime runs .NET bytecode, handles memory with GC, and provides security and type safety.
Open the full page for Why, Steps, Example and Key takeaway.