title: get object type and assign values accordingly
body: <p>I have an arraylist that gets <strong>different type of values</strong> in it, 1st value-><strong>string</strong>,2nd value-> <strong>datetime</strong>, 3rd value--> <strong>boolean</strong> and 4th value is <strong>int</strong>, how do I find thier type and assign those values accordingly, any help is appreciated:)</p>
  
  <p><strong>here is  my Code:</strong></p>
  
  <pre><code>foreach (object obj in lstTop)
              {
  
                if(obj.GetType() == string)
                  {do this...)
                else if(obj.GetType() == DateTime)
                  {do this....}
                else if(obj.GetType() == bool)
                  {do this....}
                else if(obj.GetType() == Int)
                  {do this....}
              }
  </code></pre>
  
  <p>Thank you all, <strong>my Final Code:</strong></p>
  
  <pre><code>string Subscription = "";
          DateTime issueFirst;
          DateTime issueEnd;
  
          foreach (object obj in lstTop)
          {
              ///Type t = obj.GetType();
              if (obj is string)
                  Subscription += obj + ",";
              else if (obj is DateTime)
              {
                 Subscription += Convert.ToDateTime(obj).ToShortDateString() + ",";
              }
             /// else if (t == typeof(DateTime))                
          }
      return ("User Authenticated user name: " + userName + ", Subscription: " + Subscription);
  </code></pre>