PageRenderTime 24ms CodeModel.GetById 18ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

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