/Rhino.Etl.Core/DataReaders/DictionaryDescriptorAdapter.cs

http://github.com/ayende/rhino-etl · C# · 30 lines · 16 code · 2 blank · 12 comment · 0 complexity · 19b33babf12f19b86b255c324ba90706 MD5 · raw file

  1. namespace Rhino.Etl.Core.DataReaders
  2. {
  3. using System;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. /// <summary>
  7. /// Adapts a dictionary to a descriptor
  8. /// </summary>
  9. public class DictionaryDescriptorAdapter : Descriptor
  10. {
  11. /// <summary>
  12. /// Initializes a new instance of the <see cref="DictionaryDescriptorAdapter"/> class.
  13. /// </summary>
  14. /// <param name="pair">The pair.</param>
  15. public DictionaryDescriptorAdapter(KeyValuePair<string, Type> pair) : base(pair.Key, pair.Value)
  16. {
  17. }
  18. /// <summary>
  19. /// Gets the value.
  20. /// </summary>
  21. /// <param name="obj">The obj.</param>
  22. /// <returns></returns>
  23. public override object GetValue(object obj)
  24. {
  25. return ((IDictionary) obj)[Name];
  26. }
  27. }
  28. }