所以,假设我有以下内容:
public class CProperty : CTitledEntity
{
private int numberOfNodes;
private int elementType;
public CProperty(int id, string title, int numberOfNodes, int elementType, string descripton = "")
: base(id, title, descripton)
{
this.numberOfNodes = numberOfNodes;
this.elementType = elementType;
}
public string Property
{
get
{
CElement.ElementTypes enumDisplayStatus = ((CElement.ElementTypes)numberOfNodes);
string stringValue = enumDisplayStatus.ToString();
return stringValue + elementType;
}
}
}
和
public CElement(int id, int numberOfNodes, int index, int[] nodes)
: base(id)
{
this.NumberOfNodes = numberOfNodes;
this.Nodes = new int[numberOfNodes];
this.Index = index;
for (int i = 0; i < numberOfNodes; i++)
this.Nodes[i] = nodes[i];
}
public int NumberOfNodes { get; set; }
public int[] Nodes { get; set; }
public int Index { get; set; }
public CProperty Property { get; set; }
我有一个清单:
CEntityCollection<CProperty> properties = ReadProperty();
CEntityCollection<CElement> elements = ReadElement();
首先,我很抱歉我的英语不好。我必须使用我从属性中提供的 CPropety 参数在 CElement 类中创建构造函数。我不知道该怎么做。