类库中的数据持久性在一个类方法之间
我正在使用.NET创建AutoCAD的类库。
问题是这些方法是从AutoCAD一个接一个地调用的,第一个读取输入文件并在内存中创建数据列表。但是,当调用新的列表时,列表为空。
我需要找到一个如何保存这些数据的解决方案。
List包含我创建的结构中的数据。方法是独立调用的,但是按顺序调用。
短代码示例:
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()方法时,为什么这些dataList和points列表是空的。以及如何避免这种情况?
没有找到相关结果
已邀请:
4 个回复
谷靛
旅牢斯讲
桔适丛
孤捷侩