不用担心List没有创建问题。
private ObservableCollection<EquipmentItem> _optionalCollection;
public ObservableCollection<EquipmentItem> OptionalCollection
{
get
{
if (this._optionalCollection == null)
{
this._optionalCollection = new ObservableCollection<EquipmentItem>();
} return this._optionalCollection;
} set
{
if (value != this._optionalCollection)
{
if (this._optionalCollection != null)
{
this._optionalCollection.Clear();
} this._optionalCollection = value;
this.RaisePropertyChangedEvent("OptionalCollection");
}
}
}