Skip to content
Preptima
mediumConceptMidSeniorStaff

What is the difference between a value type and a reference type in C#, and what do nullable reference types guarantee?

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.

5 min readUpdated 2026-08-15

Answer

Short answer

In C#, a value type value is copied when assigned or passed, while a reference type variable copies a reference to the same heap object. Nullable reference types do not change runtime behavior; they add compile-time warnings that help track possible null values.

Was this answer helpful?

Likely follow-ups

  • When would you make a type a struct rather than a class, and what would you measure to justify it?
  • What does readonly struct change, and what does the in parameter modifier do without it?
  • Your API returns a record with a non-nullable string property and a client receives null. How did that happen?
  • How does Nullable<T> differ from a nullable reference type in what the compiler emits?

Related questions

Further reading

Related Topics