Loading...
Loading...
Browse 4 real-world technical and behavioral interview questions about Csharp. Review scenarios, edge cases, and architectural best practices.
A CancellationToken in C# is cooperative cancellation, not a thread abort. Pass it through async calls, check it around long CPU loops, and define whether cancelled work leaves durable side effects behind.
A class gives reference identity, a struct gives value semantics and lives inline, and a record is a class with value-based equality and a copy-with-changes syntax generated for you. The decision is about identity and copying cost, not about which one is newest.
C# value types store data directly and copy on assignment, while reference types store references to heap objects. Nullable reference types are compile-time flow-analysis warnings, not runtime null guarantees. It also connects structs to the point an interviewer is testing.
The results reflect the list and the captured variables as they are at enumeration time, not at query construction, because a LINQ-to-objects query is an iterator holding references rather than a snapshot. Enumerating it twice runs the whole chain twice. It also connects deferred execution to the point an interviewer is testing.