Допустим, у меня есть школьная модель.
public class School {
public string Name {get; set;} // property
}
У меня есть список массивов свойств, поступающих из базы данных
var arraylist = ["ComputerParts","CellphoneParts"]
Есть ли способ добавить новое свойство в школьную модель, используя цикл for?
это то, что я думаю
- для массива циклов
- Добавить новое свойство в школьную модель
//add this -> public string ComputerParts{get; set;} -> in school model
// add this -> public string CellphoneParts {get; set;} -> in school model
Вот ожидаемый результат
public class School {
public string Name {get; set;}
public string ComputerParts{get; set;}
public string CellphoneParts {get; set;}
}