我正在编写一个调用一些 erp 类/函数的程序(erp 已经过时并且没有任何可用的支持)。我在定义“对象”时遇到了麻烦,希望能在这方面提供一些帮助。提前致谢
我有一堂课typeUDDBTble
(定义如下)。
我的编码是。
typeUDDBTbl UDDB = new typeUDDBTbl();
UDDB.name = "xxxx";
UDDB.Rec = new typeRec[1];
// Edited, incorrect code
// UDDB[0].Items = new typeFld[1];
UDDB.Rec[0].Items = new typeFld[1];
Items 是一个对象数组。我尝试使用new Object[1]
, 或其他type(typeFld)
, 但都得到了
你调用的对象是空的
知道如何解决这个问题吗?
定义:
public partial class typeUDDBTbl : object, System.ComponentModel.INotifyPropertyChanged
{
private typeRec[] recField;
private string nameField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Rec", Order = 0)]
public typeRec[] Rec
{
get
{
return this.recField;
}
set
{
this.recField = value;
this.RaisePropertyChanged("Rec");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute(DataType = "token")]
public string name
{
get
{
return this.nameField;
}
set
{
this.nameField = value;
this.RaisePropertyChanged("name");
}
}
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName)
{
System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
if ((propertyChanged != null))
{
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}
public partial class typeRec : object, System.ComponentModel.INotifyPropertyChanged
{
private object[] itemsField;
private string dummyField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Fld", typeof(typeFld), Order = 0)]
[System.Xml.Serialization.XmlElementAttribute("LangFld", typeof(typeLangFld), Order = 0)]
public object[] Items
{
get
{
return this.itemsField;
}
set
{
this.itemsField = value;
this.RaisePropertyChanged("Items");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute(DataType = "token")]
public string dummy
{
get
{
return this.dummyField;
}
set
{
this.dummyField = value;
this.RaisePropertyChanged("dummy");
}
}
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName)
{
System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
if ((propertyChanged != null))
{
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}
public partial class typeFld : object, System.ComponentModel.INotifyPropertyChanged
{
private string nameField;
private string valueField;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute(DataType = "token")]
public string name
{
get
{
return this.nameField;
}
set
{
this.nameField = value;
this.RaisePropertyChanged("name");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlTextAttribute()]
public string Value
{
get
{
return this.valueField;
}
set
{
this.valueField = value;
this.RaisePropertyChanged("Value");
}
}