I have boxed tuple:
(int, string) tuple = (1, "abc");
object box = tuple;
How to obtain tuple from box
? What is the right syntax to cast object
back to tuple?
My attempt:
var deconstruct = (int, string)box;
is obviously wrong:
Error CS1525 Invalid expression term 'int'
Error CS1525 Invalid expression term 'string'
Error CS1002 ; expected
Error CS0201 Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
ValueTuple<int, string> t = (ValueTuple<int, string>)box;
or
(int, string) t = ((int, string))box;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With