Using Linq GroupBy on IGH_Goo

Is it possible to use linq functions with the IGH_Goo type? Specifically, I am trying to group a set of custom types that contain a Dictionary<string, IGH_Goo>, as follows:

var splitAcornGroupings = splitAcorns.GroupBy(a => new { a[“fixed”].dictionary.Values }).Select(g => g.Select(a => a[“original”]));

splitAcorns is a List<string, Acorns.acorns>, and Values is returning a Dictionary<string, IGH_Goo>.ValueCollection – the idea is to group all “splitAcorns” if their List of IGH_Goo values are equal. I can get equality working for individual IGH_Goo values elsewhere in the code, so I suspect that there is something trickier about performing an equality on a List<IGH_Goo>. I am trying to avoid casting to GH_Goo because I am dealing with an arbitrary number of values and an arbitrary set of Types (including custom types coming from other plugins, etc).

Any thoughts?

Thanks,
Marc

Sorry I do not know. I almost never use LINQ, but as far as I know it’s for collection-based types. IGH_Goo is not a collection type, so I imagine LINQ can deal with IGH_Goo in the same way that LINQ deals with other general types or interfaces.

1 Like