UnitSystem list with c#

Why this error appears?

private static List<UnitSystem> Unit_list = RhinoDoc.ActiveDoc.ModelUnitSystem.GetValues(UnitSystem);


In python work fine.

Two errors:


Thanks , ToList() didn’t work
I use it like this , i hope it work

private static List<UnitSystem> Unit_list = new List<UnitSystem>();
private static Array Unit_list_ = Enum.GetValues(typeof(UnitSystem));

public static List<UnitSystem> Unitsystem()
    foreach (var u in Unit_list)
    return Unit_list;

No won’t work. 1, you don’t use the array to populate the list, and 2, you don’t clear the list prior to filling it, so that each time it is accessed it will keep adding new items.
The ToList() should work, if it doesn’t you probably are missing ‘use System.Collections.Linq’ at the top of the source file.

I don’t find System.Collections.Linq ?

Oops, that should read System.Linq