T
Travis Parks
Hello:
I wonder if there was ever a discussion about whether or not to make
creating tuples easier.
For instance, in many languages, you can simply indicate a tuple using
comma separated expressions with optional parenthesis.
I am sure supporting such a syntax would be a breaking change, but I
was hoping for _some examples_.
It would also be nice if C# supported the ability to treat "out"
parameters as tuple indexes. So, for a method like:
bool TryParse(string value, out int result);
You could grab the result simply with an expression like this:
bool success, int result = Int32.TryParse("123");
The example above would never compile today. So, why would introducing
it in future versions be a bad thing?
C# already supports "var", so why would determining the type of a
tuple be any harder:
(var number, var text) = 123, "Hello"; // automatically determines
types
Honestly, I am having a hard time coming up with any examples where
these enhancements would be a breaking change. Without syntactic
support, I'd rather not use tuples at all.
Thanks for any breaking examples!
I wonder if there was ever a discussion about whether or not to make
creating tuples easier.
For instance, in many languages, you can simply indicate a tuple using
comma separated expressions with optional parenthesis.
I am sure supporting such a syntax would be a breaking change, but I
was hoping for _some examples_.
It would also be nice if C# supported the ability to treat "out"
parameters as tuple indexes. So, for a method like:
bool TryParse(string value, out int result);
You could grab the result simply with an expression like this:
bool success, int result = Int32.TryParse("123");
The example above would never compile today. So, why would introducing
it in future versions be a bad thing?
C# already supports "var", so why would determining the type of a
tuple be any harder:
(var number, var text) = 123, "Hello"; // automatically determines
types
Honestly, I am having a hard time coming up with any examples where
these enhancements would be a breaking change. Without syntactic
support, I'd rather not use tuples at all.
Thanks for any breaking examples!