I pass this value to the parameter:
Properties.Settings.Default["Имя параметра"] = value; The question is as follows. How to determine that the type of value being set corresponds to the type of the parameter? How to cast the value value to the parameter type?
public void SetProperty(string nameProperty, string valueProperty) { ErrorManipulation(null, enumResultCode.Success);//Устанавливаем значения по умолчанию //Сохраняем параметр //string nameProperty = value; //Наименование параметра Type typeProperty = Properties.Settings.Default[nameProperty].GetType(); //Тип значения параметра try { Properties.Settings.Default[nameProperty] = Convert.ChangeType(valueProperty, typeProperty); //передаваемое значение приводим к типу параметра PropportiesSave(); //сохраняем значение параметра } catch (Exception e) //Если не удалось преобразовать значение { ErrorManipulation(string.Format("{0}; Источник: {1}", e.Message, e.Source), enumResultCode.Error);//Устанавливаем значения при возникновении исключения } }