Visual Studio C# - Input Data Tree "GH_Text" datatype

How can I declare an Input DataTree with “GH_Text” data type, tried “GH_String” but it didn’t work got invalid cast error message

GH_String works fine for me. You’ve typed GH_Text in there I think in the screengrab.

GH_Text works for List item, but won’t work for GH_Structure.

I am getting this when I use GH_Structure<GH_String>

image

That’s a different question.

Firstly, this works fine with no error:

To access the actual string inside, you need to access the value. For example:

GH_String myString = new GH_String();
string soupdragon = myString.Value;

Value is not available
image

Ah…try this:

string myString;
GH_Convert.ToString(Loads.get_Branch(0)[0], out myString, GH_Conversion.Primary);

The culprit was “GH_Text” not “GH_String”

Making all datatypes “GH_String” and accessing the data tree as shown below resolved the issue

Loads.get_Branch(i)[j]–>Loads.Branches[i][j].Value

Well, that’s what I said at the start. Oh well.