title: How to check if a variable is Array or Object?
body: <p>For deserialising a json object, I had to define a parent class that would contain an object or an array of objects for the child class. It has to be an object if an object was retrieved, or an array of objects if an array was retrieved from the json.</p>
  
  <p>JSON array object</p>
  
  <pre><code>{"y":{"x":[{"data":28}, {"data":56}, {"data":89}]}}
  </code></pre>
  
  <p>JSON object</p>
  
  <pre><code>{"y":{"x":{"data":28}}}
  </code></pre>
  
  <p>y is receiving x at a time, and x[] at another time. There is no such condition to determine whether y would recieve an array or an object. </p>
  
  <p>Hence for determining whether I received an array or not, I am checking the IsArray() condition.</p>
  
  <p>I tried</p>
  
  <pre><code>class Y
  {
     public X x { get { return System.IsArray() ? new X() : new x[] }; set; }
  }
  
  class X
  {
     public int data { get; set; }
  }
  </code></pre>
  
  <ol>
  <li>It isnt working.</li>
  <li>System.IsArray() isn't being recognised??</li>
  </ol>