All questions
Showing of 110Explain the difference between value types and reference types in C#.
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Value Types:
- Stored directly in memory (stack for local variables)
- Hold the actual data
- Examples:
int,bool,char,struct,enum - Assignment copies the value
- Default values are zero/false/null equivalent
Reference Types: - Stored on the heap, variable holds a reference to the memory location
- Examples:
class,string,array,delegate - Assignment copies the reference, not the data
- Default value is
null - Multiple variables can reference the same object
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is the difference between `const` and `readonly` in C#?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
const:
- Compile-time constant
- Must be initialized at declaration
- Value cannot change
- Implicitly static
- Only primitive types, null, or string literals
readonly: - Runtime constant
- Can be initialized at declaration or in constructor
- Value can be set once per instance
- Can be instance or static
- Can hold any type including complex objects
public class Example
{
const int MAX_SIZE = 100; // Compile-time constant
readonly DateTime createdDate; // Runtime constant
public Example()
{
createdDate = DateTime.Now; // Can set in constructor
}
}
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What are namespaces in C# and why are they important?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Namespaces organize code into logical groups and prevent naming conflicts. They provide a hierarchical organization system for types.
Benefits:
- Avoid naming collisions
- Organize related functionality
- Improve code readability
- Enable partial type loading
namespace MyCompany.DataAccess
{
public class DatabaseConnection { }
}
namespace MyCompany.UI
{
public class DatabaseConnection { } // Same name, different namespace
}
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is the `var` keyword and when should you use it?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
var enables implicit typing where the compiler determines the type from the assigned value. The variable is still strongly typed.
Best Practices:
- Use when type is obvious from assignment
- Required for anonymous types
- Use with LINQ queries for complex return types
- Avoid when it reduces code readability
var number = 42; // int
var text = "Hello"; // string
var list = new List<int>(); // List<int>
// Required for anonymous types
var person = new { Name = "John", Age = 30 };
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Explain the four pillars of Object-Oriented Programming.
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
1. Encapsulation: Bundling data and methods together, hiding internal implementation details.
2. Inheritance: Creating new classes based on existing classes, promoting code reuse.
3. Polymorphism: Objects of different types can be treated as instances of the same type through a common interface.
4. Abstraction: Hiding complex implementation details while showing only essential features.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Explain method overriding vs method overloading.
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Method Overloading:
- Multiple methods with same name but different parameters
- Compile-time polymorphism
- Same class can have overloaded methods
Method Overriding: - Redefining a method in derived class
- Runtime polymorphism
- Requires
virtualin base class andoverridein derived class
// Overloading
public class Calculator
{
public int Add(int a, int b) { return a + b; }
public double Add(double a, double b) { return a + b; }
}
// Overriding
public class Shape
{
public virtual double GetArea() { return 0; }
}
public class Circle : Shape
{
public override double GetArea() { return Math.PI * radius * radius; }
}
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Explain access modifiers in C#.
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
public: Accessible from anywhere.
private: Accessible only within the same class.
protected: Accessible within the class and its derived classes.
internal: Accessible within the same assembly.
protected internal: Accessible within the same assembly or derived classes.
private protected: Accessible within the same assembly and only in derived classes.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What are constructors and their types in C#?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Constructors are special methods called when an object is created. They initialize the object's state.
Types:
- Default Constructor: No parameters, provided by compiler if none defined
- Parameterized Constructor: Takes parameters for initialization
- Copy Constructor: Not directly supported, must be implemented manually
- Static Constructor: Initializes static members, called once per type
- Private Constructor: Prevents instantiation (often used in singleton pattern)
public class Person
{
// Parameterized constructor
public Person(string name, int age)
{
Name = name;
Age = age;
}
// Static constructor
static Person()
{
// Initialize static members
}
}
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What are nullable types and how do you use them?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Nullable types allow value types to have null values. Useful for database scenarios where values might be undefined.
int? nullableInt = null;
bool? nullableBool = null;
// Checking for null
if (nullableInt.HasValue)
{
int value = nullableInt.Value;
}
// Null coalescing operator
int result = nullableInt ?? 0; // Use 0 if null
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Explain the difference between `string` and `StringBuilder`.
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
string:
- Immutable - operations create new string objects
- Good for few string operations
- Thread-safe (immutability)
StringBuilder: - Mutable - modifies existing buffer
- Efficient for multiple string operations
- Not thread-safe
- Has capacity management
// Inefficient - creates multiple string objects
string result = "";
for (int i = 0; i < 1000; i++)
{
result += i.ToString(); // Creates new string each time
}
// Efficient - uses internal buffer
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 1000; i++)
{
sb.Append(i); // Modifies existing buffer
}
string result = sb.ToString();
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Explain implicit and explicit type conversion.
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Implicit Conversion:
- Automatic conversion by compiler
- No data loss
- Smaller to larger types
Explicit Conversion: - Manual conversion using cast operator
- Potential data loss
- Larger to smaller types or incompatible types
// Implicit conversion
int intValue = 123;
double doubleValue = intValue; // Automatic conversion
// Explicit conversion
double largeValue = 123.456;
int smallValue = (int)largeValue; // Manual cast, loses decimal part
// Using Convert class
string numberString = "123";
int convertedValue = Convert.ToInt32(numberString);
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is the difference between `Parse()` and `TryParse()` methods?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Parse():
- Throws exception if conversion fails
- Returns converted value directly
- Use when certain input is valid
TryParse(): - Returns boolean indicating success/failure
- Uses
outparameter for converted value - Use when input validity is uncertain
// Parse - throws exception on failure
try
{
int value1 = int.Parse("123");
int value2 = int.Parse("abc"); // Throws FormatException
}
catch (FormatException ex) { }
// TryParse - safe conversion
if (int.TryParse("123", out int value3))
{
// Conversion successful
}
else
{
// Conversion failed, value3 is 0
}
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Explain the difference between Array, ArrayList, and List<T>.
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Array:
- Fixed size
- Type-safe
- Best performance
- Zero-based indexing
ArrayList: - Dynamic size
- Stores objects (boxing for value types)
- Not type-safe
- Legacy, avoid in new code
List: - Dynamic size
- Type-safe with generics
- No boxing for value types
- Preferred choice for dynamic collections
// Array
int[] array = new int[5];
// ArrayList (avoid)
ArrayList arrayList = new ArrayList();
arrayList.Add(1); // Boxing occurs
arrayList.Add("text"); // No compile-time type checking
// List<T> (preferred)
List<int> list = new List<int>();
list.Add(1); // No boxing
// list.Add("text"); // Compile-time error
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What are the different types of generic collections in C#?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
List-based:
List<T>- Dynamic arrayLinkedList<T>- Doubly linked list
Set-based:HashSet<T>- Unique elements, fast lookupSortedSet<T>- Sorted unique elements
Dictionary-based:Dictionary<K,V>- Key-value pairs, fast lookupSortedDictionary<K,V>- Sorted key-value pairsConcurrentDictionary<K,V>- Thread-safe dictionary
Queue/Stack:Queue<T>- FIFO collectionStack<T>- LIFO collection
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Explain the try-catch-finally block structure.
What is LINQ and what are its benefits?
Explain the difference between query syntax and method syntax in LINQ.
What are lambda expressions and how are they used in LINQ?
What is the difference between anonymous methods and lambda expressions?
What is the difference between synchronous and asynchronous programming?
What is the difference between `Task` and `Task<T>`?
What is the difference between stack and heap memory?
What are extension methods and how do you create them?
Explain raw string literals in C# 11.
Explain global using directives and file-scoped namespaces.
Explain the differences between .NET Framework, .NET Core, and .NET 5+.
What is the difference between `ref`, `out`, and `in` parameters?
Explain anonymous types and their limitations.
What is the `params` keyword and how is it used?
Explain the `using` declaration vs `using` statement.
Explain tuple types and deconstruction.
What are switch expressions vs switch statements?
What is the difference between a class and a struct in C#, and when would you actually reach for a struct?
Explain the concept of boxing and unboxing in C#.
Explain the difference between `==` operator and `Equals()` method.
What is the difference between `abstract` class and `interface`?
What is the difference between `virtual`, `override`, and `new` keywords?
What is the difference between composition and inheritance?
Explain the concept of sealed classes and methods.
What is string interning in C#?
What are generics and what are their benefits?
Explain generic constraints in C#.
What is the difference between IEnumerable and IEnumerator?
Explain the difference between `IEnumerable<T>` and `IQueryable<T>`.
What is the difference between `throw` and `throw ex`?
What are custom exceptions and when should you create them?
Explain the using statement and IDisposable interface.
What is the difference between System.Exception and System.ApplicationException?
What is deferred execution in LINQ?
Explain the difference between `First()`, `FirstOrDefault()`, `Single()`, and `SingleOrDefault()`.
Explain `GroupBy` in LINQ with an example.
What is the difference between `Select` and `SelectMany`?
Explain `Join` operations in LINQ.
What are delegates in C# and how do they work?
Explain the difference between `Func`, `Action`, and `Predicate` delegates.
What are events and how are they different from delegates?
Explain event handling patterns in C#.
Explain `async` and `await` keywords.
Explain `ConfigureAwait(false)` and when to use it.
What is the difference between `Task.Run()` and direct async method call?
Explain parallel programming with `Task.WhenAll` and `Task.WhenAny`.
What are the best practices for async/await?
How does garbage collection work in C#?
What are finalizers and destructors in C#?
Explain memory leaks in C# and how to prevent them.
What is reflection in C# and when would you use it?
Explain attributes in C# and provide examples.
Explain partial classes and partial methods.
What is the `dynamic` keyword and when should you use it?
Explain the yield keyword and iterators.
What are nullable reference types and how do they work?
Explain records in C# and their benefits.
What are pattern matching enhancements in modern C#?
Explain the `required` keyword in C# 11.
What are list patterns in C# 11?
What is UTF-8 string literals feature in C# 11?
What are the new features in C# 12?
What are common coding design patterns and idioms?
What are common debugging and testing practices in C#?
What are the differences between .NET versions and when to use each?
Explain minimal APIs in .NET 6+.
What is dependency injection and how is it implemented in .NET?
Explain threading concepts: Thread, ThreadPool, and Task.
What are locks and synchronization in C#?
Explain the Repository and Unit of Work patterns.
Explain indexers in C#.
What are operator overloading and how do you implement it?
What are local functions and when would you use them?
Explain the service lifetimes in the .NET dependency injection container and what a captive dependency is.
How do you support cancellation in async C# code with CancellationToken and CancellationTokenSource?
What is IAsyncEnumerable<T> and how does await foreach differ from returning Task<IEnumerable<T>>?
How would you design a thread-safe singleton in C#?
Should you ever call GC.Collect() manually?
What is the correct middleware order for routing, CORS, authentication, and authorization in ASP.NET Core?
Your endpoint returns 50 rows but the logs show 51 queries. What happened?
You see async void in a code review. Why do you flag it?
Explain covariance and contravariance in generics.
Explain weak references and when to use them.
What is the `stackalloc` keyword and when should you use it?
Explain `Span<T>` and `Memory<T>` and their use cases.
What are ref structs and their limitations?
Explain generic math and static interface members in C# 11.
What are scoped variables and ref safety in C# 11?
Explain performance considerations and best practices in C#.
Explain security best practices in C#.
What are the latest trends and future directions in C#?
What are source generators and how do they work?
What are expression trees and how are they used?
What is ValueTask<T> and when should you use it instead of Task<T>?
What actually happens when you call .Result or .Wait() on a Task?
This answer is part of Pro.
The full written answer, with the trade-offs and follow-ups an interviewer will probe.
No matches
Try a different filter or search term.
96 of 110 C# answers are in Pro.
Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.
- Full answers + code
- AI explanations, simpler or deeper
- 1,000 AI credits / month
- Cancel anytime
Change topic
Pick a different technology or stack. Your current topic stays put until you choose a new one.
MEAN
MongoDB, Express, Angular, Node.jsMERN
MongoDB, Express, React, Node.jsDjango
Python Full-Stack DevelopmentRuby on Rails
Convention over ConfigurationServerless on AWS
Serverless Architecture on AWSInterviewers also test these - they're common to every stack, whichever one you picked above.
Flutter Mobile
Flutter Cross-Platform Mobile DevelopmentInterviewers also test these - they're common to every stack, whichever one you picked above.
Spring Boot
Enterprise Java Development.NET
Microsoft EcosystemVue
Vue.js, Vite, TypeScript, Tailwind, Node.jsGo Backend
Golang, gRPC, PostgreSQL, Redis, RabbitMQInterviewers also test these - they're common to every stack, whichever one you picked above.
FastAPI
Python, FastAPI, SQLAlchemy, PostgreSQLReact Native
React, TypeScript, Redux, FirebaseiOS Native
Swift, SwiftUI, UIKit, FirebaseAndroid Native
Java, Jetpack Compose, FirebaseDevOps / Platform
Docker, Kubernetes, Terraform, CI/CDInterviewers also test these - they're common to every stack, whichever one you picked above.
AI Engineer
LLMs, RAG, Agents, EvalsAI-Powered Developer
Claude Code, Copilot, Agentic WorkflowsCore SWE Interview Prep
Data structures, algorithms, OS, concurrency, networking, gitInterviewers also test these - they're common to every stack, whichever one you picked above.
Interviewers also test these - they're common to every stack, whichever one you picked above.