我正在使用 .NET 为 AutoCAD 创建一个类库。
问题是这些方法从 AutoCAD 中依次调用,第一个方法读取输入文件并在内存中创建数据列表。但是,当调用新的列表时,列表为空。
我需要找到一个解决方案如何保留这些数据。该列表包含我创建的结构中的数据。方法是独立调用的,但是是按顺序调用的。
短代码示例:
namespace GeoPjuvis
{
...
public class Program
{
...
//program variables
private List<GeoData> dataList;
private List<DataPoint> points;
private int mapScale;
public Program()
{
dataList = new List<GeoData>();
points = new List<DataPoint>();
}
//Initialization method of the program. Makes praperations. Reads files. Add points to map.
[CommandMethod("geoinit", CommandFlags.Session)]
public void Init()
{
...
}
//method uses data gathered before and selects points
[CommandMethod("selectPoints", CommandFlags.Session)]
public void SelectPoints()
{
...
}...
那么为什么当我调用 SelectPoints() 方法时这些数据列表和点列表是空的。以及如何避免这种情况?