public static void AddVolatileDataTree <T1, T2>(this IGH_Param param, IGH_Structure structure, Converter <T1, T2> converter) where T1 : IGH_Goo where T2 : IGH_Goo { for (int p = 0; p < structure.PathCount; ++p) { var path = structure.get_Path(p); var srcBranch = structure.get_Branch(path); var data = srcBranch.As <T1>().Select(x => x == null ? default : converter(x)); param.AddVolatileDataList(path, data); } }