protected override void OnRemove(int index, object value) { if (value == null) { throw new ArgumentNullException("value"); } CommandLineArgument argument = value as CommandLineArgument; if (argument == null) { throw new ArgumentException(c_msgInvalidArgumentType, "value"); } if (argument.Parser == _parser) { argument.AttachParser(null); } }
protected override void OnSet(int index, object oldValue, object newValue) { if (newValue == null) { throw new ArgumentNullException("value"); } CommandLineArgument newArgument = newValue as CommandLineArgument; if (newArgument == null) { throw new ArgumentException(c_msgInvalidArgumentType, "newValue"); } CommandLineArgument oldArgument = (CommandLineArgument)oldValue; if (oldArgument.Parser == _parser) { oldArgument.AttachParser(null); } if (_parser != null) { newArgument.AttachParser(_parser); } }