InterviewSolution
Saved Bookmarks
| 1. |
How to create a tuple with string and int items in C# |
|
Answer» Creating a tuple with STRING and INT items: Tuple<int, string> t = new Tuple<int, string>(100, "john");The following is an example: using System; class Example { STATIC void Main() { Tuple<int, string> t = new Tuple<int, string>(100, "john"); if (t.Item1 == 100) { Console.WriteLine(t.Item1); } if (t.Item2 == "john") { Console.WriteLine(t.Item2); } } }The output: 100 John |
|