Initialize the tuple to an empty tuple -
Tuple<string, string> myTuple;
If you want to check the value in the tuple i.e. if it is null -
using System; namespace Demo { class Program { static void Main(string[] args) { Tuple <int, string> tuple = new Tuple<int, string>(10, null); if (tuple.Item1 == 10) { Console.WriteLine(tuple.Item1); } if (tuple.Item2 == null) { Console.WriteLine("Item is null"); } } } }
The above is the detailed content of How to initialize a tuple to an empty tuple in C#?. For more information, please follow other related articles on the PHP Chinese website!