/// <summary> /// Adds the specified parser to the parser collection. If there is another parser matching the new parser's result type, the existing parser is removed. /// </summary> /// <param name="parser">The parser to add.</param> public void Add(ISimpleParser parser) { Contract.Requires(parser.ResultType != typeof(string)); Contract.Requires(Nullable.GetUnderlyingType(parser.ResultType) == null); this.parsers.AddOrUpdate(parser.ResultType, parser, (_, __) => parser); }
/// <summary> /// Removes any parsers matching the specified parser's result type from the parser collection. If there is no parser defined for that type, then this method is a noop. /// </summary> /// <param name="parser">The parser specifying the result type of the parser to remove.</param> public void Remove(ISimpleParser parser) { this.Remove(parser.ResultType); }
/// <summary> /// Removes any parsers matching the specified parser's result type from the parser collection. If there is no parser defined for that type, then this method is a noop. /// </summary> /// <param name="parser">The parser specifying the result type of the parser to remove. May not be <c>null</c>.</param> public void Remove(ISimpleParser parser) { Contract.Requires(parser != null); this.Remove(parser.ResultType); }
/// <summary> /// Adds the specified parser to the parser collection. If there is another parser matching the new parser's result type, the existing parser is removed. /// </summary> /// <param name="parser">The parser to add. May not be <c>null</c>.</param> public void Add(ISimpleParser parser) { Contract.Requires(parser != null); this.parsers.AddOrUpdate(parser.ResultType, parser, (_, __) => parser); }