I was thinking to use Tuple
class to store 2 integer information (StartAddress, EndAddress) I need in my program.
But I discover that Tuple
items are ReadOnly, so if I need to set a value for an item, I need to re-instantiate a Tuple.
What is the reason behind this design decision?
Tuples originated in functional programming. In (purely) functional programming, everything is immutable by design - a certain variable only has a single definition at all times, as in mathematics. The .NET designers wisely followed the same principle when integrating the functional style into C#/.NET, despite it ultimately being a primarily imperative (hybrid?) language.
Note: Though I suspect the fact that tuples are immutable doesn't really make your task much harder, there are also anonymous types (or perhaps just a simple struct) you might want to use.