Just wondering if there's an easy way to know how many elements are contained in a Tuple class
eg.
var a = new Tuple<int,int>(1,2);
but how many elements are there? Perhaps we don't care if we try to cast via the as keyword
var a1 = a as Tuple<int>
if(a1!=null)
var a2 = a as Tuple<int,int>
if(a2!=null)
Just after a little feedback. Are many people using Tuple?
var a = new Tuple<int, int>(1, 2);
var aType = a.GetType();
var numberOfGenericParameters = aType.GetGenericArguments().Length;
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