C# Interview

Concurrency, Performance & Design

C# interview questions covering concurrency, performance & design.

10 Questions Filter by level

Interview questions

Open a question for the full answer, code and interview guidance.

10 Results
111
SeniorAdvanced

What are concurrent collections in .NET?

Concurrent collections are thread-safe collection types designed for access by multiple threads.

112
SeniorAdvanced

What is SemaphoreSlim, and when is it useful?

SemaphoreSlim limits how many callers can enter a protected region concurrently. Unlike lock, it can allow more than one caller and supports asynchronous waiting through WaitAsync.

113
SeniorAdvanced

What is Interlocked in C#?

Interlocked provides atomic operations for simple shared variables without requiring a traditional lock.

114
SeniorAdvanced

What is deadlock, and how can it be avoided?

A deadlock occurs when operations wait indefinitely for resources or each other in a cycle, so none can continue.

115
SeniorAdvanced

What is thread safety?

Thread safety means code behaves correctly when accessed concurrently by multiple threads.

116
SeniorAdvanced

What is serialization in C#?

Serialization converts an object's data into a format suitable for storage or transmission, such as JSON. Deserialization reconstructs an object representation from that format.

117
SeniorAdvanced

What is the difference between System.Text.Json and Newtonsoft.Json?

System.Text.Json is built into modern .NET and is optimized for performance, low allocations, and integration with ASP.NET Core. It is the default JSON serializer for current ASP.NET Core applications.

118
SeniorAdvanced

What is Span<T> in C#?

Span<T> is a stack-only type representing a contiguous region of memory. It can provide efficient slicing and processing of arrays, stack memory, strings through related read-only spans, and other buffers without allocating new objects for many operations.

119
SeniorAdvanced

What is StringBuilder, and when should it be used?

StringBuilder is a mutable buffer designed for efficiently constructing strings through many modifications or concatenations.

120
SeniorAdvanced

How would you diagnose a slow C# or ASP.NET Core application?

Performance diagnosis should begin with measurement rather than random code changes.