I am using ver 0.6.0012 C# components.
This newer version is very strict in casting types.
I have been fighting with "specified cast is not valid" error (without specifying which type to which type) for a while.
This was revealed to be caused by connecting Numberslider to Integer input. (Even if the Numberslider outputs integer, the type is double.)
check tobias' answer:
"I had the same problem a while ago, my solution was to change the hint of the input list "x" from double to Object and then cast the items back to double like so: sum = sum + (double) x[j];"
Dimitrie Stefanescu @idid
here it is: http://www.grasshopper3d.com/forum/topics/trouble-on-the-c-side?pag...
check tobias' answer:
"I had the same problem a while ago, my solution was to change the hint of the input list "x" from double to Object and then cast the items back to double like so: sum = sum + (double) x[j];"
Aug 8, 2009