Reference types vs Value types

Reference types:

  • passed via reference
  • reside on the heap
  • subject to GC
  • inherits from System.Object

Value types:

  • passed via value
  • reside on the stack, CPU registers or the heap
  • no subject to GC
  • inherits from System.ValueType

Further read:

https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/reference-types

https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/value-types

https://www.infoworld.com/article/3043992/a-deep-dive-value-and-reference-types-in-net.html

Leave a Reply

Your email address will not be published. Required fields are marked *

Solve : *
26 + 13 =