1. Error (CS0019): Operator '+' cannot be applied to operands of type 'object' and 'int' (line 57)

Hi, am a beginner and just started learning about C# . I have downloaded the PDF and GH file from “C#ScriptingForGrasshopperSamples_1stEdition_20200318”. However, when I try to recreate the same component(by dragging in a new C# component), the GH C# Component turns red. Would really appreciate if someone could help please.

Have provided the GH file and images below, am really struggling on this one. Would really appreciate if someone could help. Thanks.


C# Issue.gh (13.3 KB)

Right-click the C# ‘x’ input and set ‘Type hint’ to ‘Double’, just like the C# you are copying.

Hi @Joseph_Oster , thanks very much ! Really appreciate it. I have switched the type hint and its working now. May I ask normally is the type hint actually set before writing the code ? Are there any particular instances when System.Object type hint is desirable ?

I don’t do enough scripting to answer those questions, but I would always set the ‘Type hint’ on inputs.

Noted on the setting of the type before scripting, thanks for the help, do appreciate it !