我不知道如何将参数添加到子类的列表中。我有这门课:
public partial class remSolicitudesEnt
{
private Solicitud[] solicitudesField;
public Solicitud[] Solicitudes {
get {
return this.solicitudesField;
}
set {
this.solicitudesField = value;
}
}
}
在我的代码中,我有这个:
private static remSolicitudesEnt getRemSolicitudesEnt()
{
remSolicitudesEnt filter= new remSolicitudesEnt();
//WHEN I ADD AN ELEMENT TO A NORMAL LIST...
List<Profesional> profesionals = new List<Profesional>();
Profesional p1 = new Profesional();
profesionals.Add(pd1);
//BUT HOW CAN I ADD AN ELEMENT TO A LIST FROM THE SUBCLASS??
Solicitud s = new Solicitud();
//filter.Solicitudes.Add(s); THIS CAN'T BE DONE
}
我如何添加元素&#34; Solicitud&#34;到列表?
提前致谢!
答案 0 :(得分:3)
您的类是数组而不是列表。所以你没有方法在那里添加。只需更改
的定义即可类:
public partial class remSolicitudesEnt {
private List<Solicitud> solicitudesField;
public List<Solicitud> Solicitudes
{
get { return this.solicitudesField; }
set { this.solicitudesField = value; }
}
}