You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error when class has list as property and list is null.
here is example:
Declare classes:
public class ZZZ
{
public string aaa { get; set; } = "zzz aaa";
public string bbb { get; set; } = "zzz bbb";
}
public class YYY
{
public List<ZZZ> zzz; // field !!!
public string aaa { get; set; } = "yyy aaa";
public string bbb { get; set; } = "yyy bbb";
}
public class XXX
{
public List<ZZZ> zzz { set; get; } // property !!!
public string aaa { get; set; } = "xxx aaa";
public string bbb { get; set; } = "xxx bbb";
}
code:
var zzList = new List<ZZZ>() { new ZZZ(), new ZZZ(), new ZZZ() }; // some list
var yy = new List<YYY>() {
new YYY() { zzz = zzList },
new YYY() { zzz = zzList }
};
var xx = new List<XXX>() {
new XXX() { zzz = zzList },
new XXX() { zzz = zzList }
};
var lstYY = new BindingListView<YYY>(yy); // ok
var lstXX = new BindingListView<XXX>(xx); // ok
// recreate with zzz = null
yy = new List<YYY>() {
new YYY(),
new YYY()
};
xx = new List<XXX>() {
new XXX(),
new XXX()
};
lstYY = new BindingListView<YYY>(yy); // ok
lstXX = new BindingListView<XXX>(xx); // error
`
The text was updated successfully, but these errors were encountered:
error when class has list as property and list is null.
here is example:
Declare classes:
code:
`
The text was updated successfully, but these errors were encountered: