I get the following error message with the code below. I am not sure if this has to do with the Grasshopper kernel or if I am not writing the DataAccess.GetDataList()
method correctly. I hope you can help.
The type arguments for method 'Grasshopper.Kernel.IGH_DataAccess.GetDataList<T>(int, System.Collections.Generic.List<T>)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
code:
protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
{
pManager.AddTextParameter("SomeString", "SS", "Send Some String Somwhere", GH_ParamAccess.list); //0
}
protected override void SolveInstance(IGH_DataAccess DA)
{
string SomeString = default(string);
DA.GetDataList(0, ref SomeString);
if (!DA.GetDataList(0, ref SomeString)) return;
}
The error says the function requires an int
and a List<T>
but you're supplying an int
and a string
. You also don't need the ref
modifier.
You need to do something like this:
List<string> someStrings = new List<string>();
if(! DA.GetDataList(0, someStrings)) return;