KeyValuePairList.cs 696 B

123456789101112131415161718192021222324252627
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace BestHTTP.Extensions
  6. {
  7. /// <summary>
  8. /// Base class for specialized parsers
  9. /// </summary>
  10. public class KeyValuePairList
  11. {
  12. public List<HeaderValue> Values { get; protected set; }
  13. public bool TryGet(string valueKeyName, out HeaderValue @param)
  14. {
  15. @param = null;
  16. for (int i = 0; i < Values.Count; ++i)
  17. if (string.CompareOrdinal(Values[i].Key, valueKeyName) == 0)
  18. {
  19. @param = Values[i];
  20. return true;
  21. }
  22. return false;
  23. }
  24. }
  25. }