We really can't help you with that limited a fragment and no error message: if I copy'n'paste that code into a new method, I get 141 errors, starting with
CS1519 Invalid token 'else' in class, struct, or interface member declaration
because the if condition above that code is missing.
But ... it's quite likely that if you look at your error message, it'll tell you what teh problem is, as the second error is:
CS8124 Tuple must contain at least two elements.
Looking at the line it dislikes gives an obvious error:
else if
( <<<<----- This should be a open curly bracket.
index = -1)
if (IsQuantityType(types))
Change that, and see if it helps at all...