【发布时间】:2014-01-10 21:51:27
【问题描述】:
我的主要方法是SolveInstance() 方法,用于一个名为 Grasshopper 3D 的软件,它本身是 Rhino 的一个插件。
在这个方法中,我声明了两个新列表,第一个是List<Color> colors 和List<Double> spaceValues,用于存储它们各自的颜色和双精度对象。
下一行:
if (!DA.GetDataList(0, colors)) return;
if (!DA.GetDataList(1, spaceValues)) return;
仅用于将值存储到这些列表中。
我的代码:
List<Color> colors = new List<Color>();
List<Double> spaceValues = new List<Double>();
if (!DA.GetDataList(0, colors)) return;
if (!DA.GetDataList(1, spaceValues)) return;
int width = 10;
int height = 0;
int U = 1; // numbers of x-objects
int V = 100; // number of y-objects
DA.GetData(2, ref height);
string file = null;
bool save = false;
DA.GetData(3, ref file);
DA.GetData(4, ref save);
HeatMap map = new HeatMap(colors, width, height, file, U, V);
_maps.Clear();
_maps.Add(map);
我的问题是 - 我如何在这两个列表被解析为之前反转:
HeatMap map = new HeatMap(colors, width, height, file, U, V);
我尝试过colors.Reverse().ToArray() 和colors.ToArray().Reverse(),但两者都向我返回了错误。谢谢。
【问题讨论】:
-
这是我收到的错误:puu.sh/6gpjW/628fbd6cbe.png