В моем проекте 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; }
Я пытаюсь вставить значение Projector
в
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"
});
}