title: KeyValuePair<string,object> Is the Object Enumerable?
body: <p>How do I programmatically figure out if an object in a Key value pair is enumerable?</p>
  
  <p>I need to know if a object in the value field is a List or Array. I should be able to determine what kind of enumerable type the object is(eg a List of strings or an array of ints)  </p>
  
  <pre><code>List&lt;KeyValuePair&lt;string, object&gt;&gt; lKVP = new List&lt;KeyValuePair&lt;string, object&gt;&gt;();
  List&lt;string&gt; lS = new List&lt;string&gt; { "s1", "s2" };
  
  lKVP.Add(new KeyValuePair&lt;string, object&gt;("PassPhrase", "E92D8719-38A6-0000-961F-0E66FCB0A363"));
  lKVP.Add(new KeyValuePair&lt;string, object&gt;("Test", lS));
  </code></pre>
  
  <p>What I have tried:</p>
  
  <p>1)</p>
  
  <pre><code>foreach(KeyValuePair&lt;string,object&gt; kvp in _ParameterReplacement)
  {
      if(kvp.Value is Enumerable)
      {
          Console.WriteLine("Yes");
      }
      else
      {
          Console.WriteLine("No");
      }
   }
  </code></pre>
  
  <p>2)</p>
  
  <pre><code>foreach(KeyValuePair&lt;string,object&gt; kvp in _ParameterReplacement)
  {
      if(kvp.Value.GetType() == typeof(IEnumerable&lt;object&gt;))
      {
          Console.WriteLine("Yes");
      }
      else
      {
          Console.WriteLine("No");
      }
   }
  </code></pre>