Image by @helloitsammiel
What are Tuples?
A Tuple is a container to hold multiple values which provide readable syntax when used appropriately. Tuples are available from C# 7 and later versions. There are two types of Tuples:
- Value Type
- Reference Type
Naturally, you might ask, what is the difference between Value Type and Reference Type?
The .NET runtime manages the memory for your application. It uses two distinct places to store data in memory, known as Stack and Heap. Any Value or Reference Type can end up either on Heap or Stack purely depending upon its usage.
Mental Model : Draw two different shapes in your head. One is fast & small, and the other is big & efficiently managed. Value Types are for small & superfast (Stack), and Reference Types for big & efficient (Heap).
I will not use Stack or Heap in rest of the post. Instead, I want you build a mental model based on two distinct memory regions.