在我的 uwp 项目中,我有一个被调用的列表,Rooms这是该列表中的内容:
public string RoomID { get; set; }
public string RoomName { get; set; }
public Visibility Projector { get; set; }
public int Seats { get; set; }
public string FrontImage { get; set; }
public string Note { get; set; }
我正在尝试插入一个值Projectorin
Rooms.Add(new Room
{
RoomID = id,
RoomName = name,
FrontImage = Img1,
Seats = seats,
Note = "Lorem ipsum dolor sit amet, co"
});
有了这行代码。
Rooms.Insert(1, new Room{ Projector = Visibility.Collapsed });
但是,当我使用关键字new创建一个新房间时,是否还有其他关键字可以用于将“投影仪”值插入到我现有的房间中?
提前致谢!
编辑:
foreach (var room in data)
{
string id = room.id;
string name = room.name;
int seats = room.seats;
List<Roomattribute> roomattrib = room.roomAttributes;
foreach (var attri in roomattrib)
{
int attriId = attri.id;
string attriName = attri.name;
int attriIcon = attri.icon;
if (attriId == 1)
{
Rooms.Insert(0, new Room{ Projector = Visibility.Collapsed });
}
}
Rooms.Add(new Room
{
RoomID = id,
RoomName = name,
FrontImage = Img1,
Seats = seats,
Note = "Lorem ipsum dolor sit amet, co"
});
}
慕哥6287543
相关分类