public override void Set(OptionInfo info, string arg) { var argIndex = ArgList.IndexOf(arg); var argValue = ArgList[argIndex + 1]; var value = TranslateActivator.Activate(info.TranslatorType, info.TargetType, argValue); var property = typeof(TOptions).GetProperty(info.Name); property?.SetValue(Options, value); }
public override void Set(OptionInfo info, string arg) { object value = null; if (arg != null) { var argIndex = ArgList.IndexOf(arg); var argValue = ArgList[argIndex + 1]; value = TranslateActivator.Activate(info.TranslatorType, info.TargetType, argValue); } value = value ?? info.DefaultValue; if (value == null) { return; } var property = typeof(TOptions).GetProperty(info.Name); property?.SetValue(Options, value); }