Last active
December 25, 2018 21:37
-
-
Save bbqchickenrobot/55f31ff06bf89f29c990c34e8d58cd34 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // There is no 'Main' class here as I used Xamarin Workbooks | |
| // https://docs.microsoft.com/en-us/xamarin/tools/workbooks/install?tabs=windows | |
| #r "Newtonsoft.Json" | |
| using Newtonsoft.Json; | |
| using Newtonsoft.Json.Linq; | |
| void displayTuple((int count, string value) val){ | |
| Console.WriteLine($"Count: {val.count} - Value: {val.value}"); | |
| } | |
| var stringContent = "The answer to everything"; | |
| var mixedTuple = (42, stringContent); | |
| Func<(int count, string value)> func = () => { | |
| return mixedTuple; | |
| }; | |
| var val = func(); | |
| displayTuple(val); | |
| var json = JsonConvert.SerializeObject(val); | |
| var test2 = JsonConvert.DeserializeObject<(int count, string value)>(json); | |
| displayTuple(((int count, string value))test2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment