Accessing tuple elements C# with Example



Accessing tuple elements C# with Example

To access tuple elements use Item1-Item8 properties. Only the properties with index number less or equal to tuple 
size are going to be available (i.e. one cannot access Item3 property in Tuple). 
var tuple = new Tuple("foo", 123, true, new MyClass()); 
var item1 = tuple.Item1; // "foo" 
var item2 = tuple.Item2; // 123 
var item3 = tuple.Item3; // true 
var item4 = tuple.Item4; // new My Class() 

0 Comment's

Comment Form

Submit Comment